diff options
Diffstat (limited to 'node_modules/gulp-stream/index.js')
-rw-r--r-- | node_modules/gulp-stream/index.js | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/node_modules/gulp-stream/index.js b/node_modules/gulp-stream/index.js deleted file mode 100644 index 5c3f1ece0..000000000 --- a/node_modules/gulp-stream/index.js +++ /dev/null @@ -1,50 +0,0 @@ -var through = require('through2'); -var Stream = require('stream'); - -// Consts -const PLUGIN_NAME = 'gulp-stream'; - -function gulpStream() { - var stream = through.obj(function(file, enc, callback) { - - // keep null files as-is - if (file.isNull()) { - this.push(file); - return callback(); - } - - // keep stream files as-is - if (file.isStream()) { - this.push(file); - return callback(); - } - - // transform buffer files into buffers - if (file.isBuffer()) { - var cstream = Readable(file.contents); - cstream.on('error', this.emit.bind(this, 'error')); - file.contents = cstream; - this.push(file); - return callback(); - } - - }); - - return stream; -}; - -function Readable(buffer){ - var readable = new Stream.Readable(); - var idx = 0; - readable._read = function(size) { - var chunk = buffer.slice(0, size); - buffer = buffer.slice(size); - var finished = (chunk.length == 0 && buffer.length == 0); - this.push(finished ? null : chunk); - }; - return readable; -} - - - -module.exports = gulpStream; |