stream-pipe
add stream.pipeFrom
API
pipe
same as readable.pipe(destination, options)
import pipe from 'stream-pipe';
pipe(srcStream, destStream) // => destStream with pipeFrom = srcStream
createReadStream
same as fs.createReadStream(path, options)
import createReadStream, { ReadStream } from 'stream-pipe/fs';
demo
import * as through2 from 'through2';
import createReadStream from 'stream-pipe/fs';
let file = '../.gitignore';
createReadStream(file).pipe(through2.obj(function (chunk, enc, cb)
{
console.log(this.pipeFrom.path);
console.log(this.pipeFrom.bytesRead);
this.push(chunk);
cb();
}));