unstream

2.0.0 • Public • Published

unstream

Build Status Coverage Status

Like concat-stream, or bl except it returns a transform stream, allowing you to continue streaming after concat-buffering.

Currently unstream doesn't support object-mode.

unstream(options, transformFn (body, callback(err, data)) { })

var unstream = require('unstream');
 
fs.createReadStream('file')
  .pipe(unstream({ limit: 1024 }, function (data, callback) {
    callback(null, data.toUpperCase());
  }))
  .pipe(process.stdout);

options

Options object. Same as TransformStream options, plus some extras:

  • limit [Number] - maximum number of bytes to buffer. The default is Infinity. Set this to a hard limit to prevent memory leaks.

transformFn (body, callback) { }

Function that gets called when the buffering is complete.

  • body [Buffer] - fully buffered data from the source stream.
  • callback(err, data) - Call this to continue streaming the data to the destination. This allows you to perform a transform on the fully buffered data, and re-stream it.

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i unstream

Weekly Downloads

1,508

Version

2.0.0

License

MIT

Last publish

Collaborators

  • lxe