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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.4
    5,570
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.4
    5,570
  • 1.0.1
    241
  • 1.0.0
    0

Package Sidebar

Install

npm i stream-pipe

Weekly Downloads

4,912

Version

1.0.4

License

ISC

Unpacked Size

8.73 kB

Total Files

8

Last publish

Collaborators

  • bluelovers