| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 1 1 1 1 1 8 7 7 5 2 1 | 'use strict';
var through2 = require('through2');
var bufferFile = require('./bufferFile');
var streamFile = require('./streamFile');
function getContents(opt) {
return through2.obj(function (file, enc, cb) {
Iif (file.isDirectory()) {
cb(null, file);
}
// read and pass full contents
if (opt.buffer !== false) {
return bufferFile(file, cb);
}
// dont buffer anything - just pass streams
return streamFile(file, cb);
});
}
module.exports = getContents;
|