lib/jsdoc-to-json-schema.js
function getInputAsStream(input) {

    return new Promise(function(resolve, reject) {

        if (input.write) {

            // already a stream
            resolve(input);
        }
        else {

            // read from file
            fs.readFileAsync(input, 'utf-8').then(function(data) {

                // convert file string into stream and pipe into jsdoc-parse
                var stream = string2stream(data);

                // return stream
                resolve(stream);

            })
            .catch(function(err) {
                reject(err);
            });
        }

    });
}
function getInputAsStream(input) {

    return new Promise(function(resolve, reject) {

        if (input.write) {

            // already a stream
            resolve(input);
        }
        else {

            // read from file
            fs.readFileAsync(input, 'utf-8').then(function(data) {

                // convert file string into stream and pipe into jsdoc-parse
                var stream = string2stream(data);

                // return stream
                resolve(stream);

            })
            .catch(function(err) {
                reject(err);
            });
        }

    });
}
function getInputAsStream ( input ) { return new Promise ( function ( resolve , reject ) { if ( input . write ) { // already a stream resolve ( input ) ; } else { // read from file fs . readFileAsync ( input , 'utf-8' ) . then ( function ( data ) { // convert file string into stream and pipe into jsdoc-parse var stream = string2stream ( data ) ; // return stream resolve ( stream ) ; } ) . catch ( function ( err ) { reject ( err ) ; } ) ; } } ) ; }
Returns a file as a stream
@param {string} input - path to json/js file containing JSDoc comments
@returns {Promise} promise to return a stream if the file exists
Returns a file as a stream