lib/loader.js
function readSpecFile(file, options) {
    if (options.verbose > 1) {
        file ? console.error('GET ' + file) : console.error('GET <stdin>');
    }
    if (!file) {
        // standard input
        return readFileStdinAsync();
    } else if (file && file.startsWith('http')) {
        // remote file
        return fetch(file).then(res => {
            if (res.status !== 200) {
                throw new Error(`Received status code ${res.status}`);
            }
            return res.text();
        })
    } else {
        // local file
        // TODO error handlers?
        return readFileAsync(file, 'utf8');
    }
}
function readSpecFile(file, options) {
    if (options.verbose > 1) {
        file ? console.error('GET ' + file) : console.error('GET <stdin>');
    }
    if (!file) {
        // standard input
        return readFileStdinAsync();
    } else if (file && file.startsWith('http')) {
        // remote file
        return fetch(file).then(res => {
            if (res.status !== 200) {
                throw new Error(`Received status code ${res.status}`);
            }
            return res.text();
        })
    } else {
        // local file
        // TODO error handlers?
        return readFileAsync(file, 'utf8');
    }
}
function readSpecFile ( file , options ) { if ( options . verbose > 1 ) { file ? console . error ( 'GET ' + file ) : console . error ( 'GET <stdin>' ) ; } if ( ! file ) { // standard input return readFileStdinAsync ( ) ; } else if ( file && file . startsWith ( 'http' ) ) { // remote file return fetch ( file ) . then ( res => { if ( res . status !== 200 ) { throw new Error ( ` ${ res . status } ` ) ; } return res . text ( ) ; } ) } else { // local file // TODO error handlers? return readFileAsync ( file , 'utf8' ) ; } }
file can be null, meaning stdin
file can be null meaning stdin