headerstream

1.0.0 • Public • Published

headerstream

Grab the first n bytes out of a stream.

npm install --save headerstream

call it with a size n and a callback, callback is called with first n bytes, of stream, rest of date is simply passed through. If there is an error emitted by the stream the callback will be called with that instead of the header.

var HeaderStream = require('headerstream');
 
 
var destStream = getDestStream();
var srcStream = getSrcStream();
var headerStream = new HeaderStream(16, function (err, header) {
  headerStream.pipe(getStreamBasedOnHeader(header)).pipe(destStream);
});
srcStream.pipe(headerStream);

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    16
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    16

Package Sidebar

Install

npm i headerstream

Weekly Downloads

16

Version

1.0.0

License

MIT

Last publish

Collaborators

  • cwmma