2.0.0 • Published 9 years ago

unstream v2.0.0

Weekly downloads
1,200
License
MIT
Repository
github
Last release
9 years ago

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