Skip to content

Instantly share code, notes, and snippets.

@clonn
Created June 27, 2015 14:39
Show Gist options
  • Save clonn/844d2efd1149fb1d1098 to your computer and use it in GitHub Desktop.
Save clonn/844d2efd1149fb1d1098 to your computer and use it in GitHub Desktop.
buffer2Stream
var stream = require('stream');
// Initiate the source
var bufferStream = new stream.PassThrough();
// Write your buffer
bufferStream.end(new Buffer('Test data.'));
// Pipe it to something else (i.e. stdout)
bufferStream.pipe(process.stdout);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment