lib/runner/util.js
function (resolver, fileSrc, callback) {
        // bail out if resolver not found.
        if (!resolver) {
            return callback(new Error('file resolver not supported'));
        }

        // bail out if resolver is not supported.
        if (typeof resolver.stat !== FUNCTION || typeof resolver.createReadStream !== FUNCTION) {
            return callback(new Error('file resolver interface mismatch'));
        }

        // bail out if file source is invalid or empty string.
        if (!fileSrc || typeof fileSrc !== STRING) {
            return callback(new Error('invalid or missing file source'));
        }

        // now that things are sanitized and validated, we transfer it to the
        // stream reading utility function that does the heavy lifting of
        // calling there resolver to return the stream
        return createReadStream(resolver, fileSrc, callback);
    }
function (resolver, fileSrc, callback) {
        // bail out if resolver not found.
        if (!resolver) {
            return callback(new Error('file resolver not supported'));
        }

        // bail out if resolver is not supported.
        if (typeof resolver.stat !== FUNCTION || typeof resolver.createReadStream !== FUNCTION) {
            return callback(new Error('file resolver interface mismatch'));
        }

        // bail out if file source is invalid or empty string.
        if (!fileSrc || typeof fileSrc !== STRING) {
            return callback(new Error('invalid or missing file source'));
        }

        // now that things are sanitized and validated, we transfer it to the
        // stream reading utility function that does the heavy lifting of
        // calling there resolver to return the stream
        return createReadStream(resolver, fileSrc, callback);
    }
function ( resolver , fileSrc , callback ) { // bail out if resolver not found. if ( ! resolver ) { return callback ( new Error ( 'file resolver not supported' ) ) ; } // bail out if resolver is not supported. if ( typeof resolver . stat !== FUNCTION || typeof resolver . createReadStream !== FUNCTION ) { return callback ( new Error ( 'file resolver interface mismatch' ) ) ; } // bail out if file source is invalid or empty string. if ( ! fileSrc || typeof fileSrc !== STRING ) { return callback ( new Error ( 'invalid or missing file source' ) ) ; } // now that things are sanitized and validated, we transfer it to the // stream reading utility function that does the heavy lifting of // calling there resolver to return the stream return createReadStream ( resolver , fileSrc , callback ) ; }
Create readable stream for given file as well as detect possible file
read issues. The resolver also attaches a clone function to the stream
so that the stream can be restarted any time.

@param {Object} resolver - External file resolver module
@param {Function} resolver.stat - Resolver method to check for existence and permissions of file
@param {Function} resolver.createReadStream - Resolver method for creating read stream
@param {String} fileSrc - File path
@param {Function} callback -
Create readable stream for given file as well as detect possible file read issues . The resolver also attaches a clone function to the stream so that the stream can be restarted any time .