You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <p align="center">
  2. <a href="http://gulpjs.com">
  3. <img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
  4. </a>
  5. </p>
  6. # lead
  7. [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url]
  8. Sink your streams.
  9. ## Usage
  10. ```js
  11. var from = require('from2');
  12. var through = require('through2');
  13. var sink = require('lead');
  14. // Might be used as a Transform or Writeable
  15. var maybeThrough = through(function(chunk, enc, cb) {
  16. // processing
  17. cb(null, chunk);
  18. });
  19. from(['hello', 'world'])
  20. // Sink it to behave like a Writeable
  21. .pipe(sink(maybeThrough))
  22. ```
  23. ## API
  24. ### `sink(stream)`
  25. 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.
  26. ## License
  27. MIT
  28. [downloads-image]: http://img.shields.io/npm/dm/lead.svg
  29. [npm-url]: https://npmjs.com/package/lead
  30. [npm-image]: http://img.shields.io/npm/v/lead.svg
  31. [travis-url]: https://travis-ci.org/gulpjs/lead
  32. [travis-image]: http://img.shields.io/travis/gulpjs/lead.svg?label=travis-ci
  33. [appveyor-url]: https://ci.appveyor.com/project/gulpjs/lead
  34. [appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/lead.svg?label=appveyor
  35. [coveralls-url]: https://coveralls.io/r/gulpjs/lead
  36. [coveralls-image]: http://img.shields.io/coveralls/gulpjs/lead/master.svg
  37. [gitter-url]: https://gitter.im/gulpjs/gulp
  38. [gitter-image]: https://badges.gitter.im/gulpjs/gulp.png