lib/millstone.js
function readExtension(file, cb) {
    fs.readFile(metapath(file), 'utf-8', function(err, data) {
        if (err) {
            if (err.code === 'ENOENT') return cb(new Error('Metadata file does not exist.'));
            return cb(err);
        }
        try {
            var ext = guessExtension(JSON.parse(data));
            if (ext) {
                if (env == 'development') console.error("[millstone] detected extension of '" + ext + "' for '" + file + "'");
            }
            return cb(null, ext);
        } catch (e) {
            return cb(e);
        }
    });
}
function readExtension(file, cb) {
    fs.readFile(metapath(file), 'utf-8', function(err, data) {
        if (err) {
            if (err.code === 'ENOENT') return cb(new Error('Metadata file does not exist.'));
            return cb(err);
        }
        try {
            var ext = guessExtension(JSON.parse(data));
            if (ext) {
                if (env == 'development') console.error("[millstone] detected extension of '" + ext + "' for '" + file + "'");
            }
            return cb(null, ext);
        } catch (e) {
            return cb(e);
        }
    });
}
function readExtension ( file , cb ) { fs . readFile ( metapath ( file ) , 'utf-8' , function ( err , data ) { if ( err ) { if ( err . code === 'ENOENT' ) return cb ( new Error ( 'Metadata file does not exist.' ) ) ; return cb ( err ) ; } try { var ext = guessExtension ( JSON . parse ( data ) ) ; if ( ext ) { if ( env == 'development' ) console . error ( "[millstone] detected extension of '" + ext + "' for '" + file + "'" ) ; } return cb ( null , ext ) ; } catch ( e ) { return cb ( e ) ; } } ) ; }
Read headers and guess extension
Read headers and guess extension