src/index.js
function loadFileContents(filePath, preloaded)
{
    //use pre-supplied contents?
    if (typeof preloaded !== 'undefined' && preloaded !== null)
    {
        //return a promise which will get resolved with the preloaded value
        if (preloaded instanceof Buffer)
        {
            return promiseValue(preloaded.toString());
        }
        else
        {
            return promiseValue(String(preloaded));
        }
    }
    else
    {
        return Q.nfcall(fs.readFile, filePath).invoke('toString');
    }
}
function loadFileContents(filePath, preloaded)
{
    //use pre-supplied contents?
    if (typeof preloaded !== 'undefined' && preloaded !== null)
    {
        //return a promise which will get resolved with the preloaded value
        if (preloaded instanceof Buffer)
        {
            return promiseValue(preloaded.toString());
        }
        else
        {
            return promiseValue(String(preloaded));
        }
    }
    else
    {
        return Q.nfcall(fs.readFile, filePath).invoke('toString');
    }
}
function loadFileContents ( filePath , preloaded ) { //use pre-supplied contents? if ( typeof preloaded !== 'undefined' && preloaded !== null ) { //return a promise which will get resolved with the preloaded value if ( preloaded instanceof Buffer ) { return promiseValue ( preloaded . toString ( ) ) ; } else { return promiseValue ( String ( preloaded ) ) ; } } else { return Q . nfcall ( fs . readFile , filePath ) . invoke ( 'toString' ) ; } }
helper function to load file; returns promise that's resolved with contents
helper function to load file ; returns promise that s resolved with contents