stream-pipe
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

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();
}));

Package Sidebar

Install

npm i stream-pipe

Weekly Downloads

5,056

Version

1.0.4

License

ISC

Unpacked Size

8.73 kB

Total Files

8

Last publish

Collaborators

  • bluelovers