パッケージの詳細

lead

gulpjs8.3mMIT4.0.0

Sink your streams.

streams, sink, through, writeable

readme

lead

NPM version Downloads Build Status Coveralls Status

Sink your streams.

Usage

var { Readable, Transform } = require('streamx');
var sink = require('lead');

// Might be used as a Transform or Writeable
var maybeThrough = new Transform({
  transform(chunk, cb) {
    // processing
    cb(null, chunk);
  },
});

Readable.from(['hello', 'world'])
  // Sink it to behave like a Writeable
  .pipe(sink(maybeThrough));

API

sink(stream)

Takes a stream to sink and returns the same stream. Sets up event listeners to infer if the stream is being used as a Transform or Writeable stream and sinks it on nextTick if necessary. If the stream is being used as a Transform stream but becomes unpiped, it will be sunk. Respects pipe, on('data') and on('readable') handlers.

License

MIT

更新履歴

Changelog

4.0.0 (2022-09-22)

⚠ BREAKING CHANGES

  • Remove piping to a Writable and instead call resume on stream

Features

  • Remove piping to a Writable and instead call resume on stream (27324d6)

Bug Fixes

  • Ensure project works with different streams (#8) (27324d6)
  • Use listenerCount API on streams (27324d6)