Skip to content

pipe to a streamsink, and then create readable streams based on that

License

Notifications You must be signed in to change notification settings

andrewrk/node-streamsink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-streamsink

Pipe a stream to a StreamSink, and then you can create a ReadableStream, String, or Buffer from the StreamSink.

Usage

var StreamSink = require('streamsink');

var sink = new StreamSink();

fs.createReadStream("foo.txt").pipe(sink);
sink.on('finish', function() {
  // sink has now buffered foo.txt
  sink.createReadStream().pipe(someDestination);

  // or use toString([encoding], [start], [end])
  console.log(sink.toString('utf8'));

  // or use toBuffer()
  sink.toBuffer();
});

// you can also create instances from a list of buffers
var sink = StreamSink.fromBufferList([new Buffer("aoeu"), new Buffer("foo")]);

About

pipe to a streamsink, and then create readable streams based on that

Resources

License

Stars

Watchers

Forks

Packages

No packages published