https://github.com/gulpjs/lead
Sink your streams.
https://github.com/gulpjs/lead
flowing gulp gulpjs stream writable-streams
Last synced: 4 months ago
JSON representation
Sink your streams.
- Host: GitHub
- URL: https://github.com/gulpjs/lead
- Owner: gulpjs
- License: mit
- Created: 2017-04-27T00:25:16.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-04-15T22:03:42.000Z (about 2 years ago)
- Last Synced: 2024-10-29T15:14:39.810Z (7 months ago)
- Topics: flowing, gulp, gulpjs, stream, writable-streams
- Language: JavaScript
- Homepage:
- Size: 14.6 KB
- Stars: 17
- Watchers: 7
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# lead
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url]
Sink your streams.
## Usage
```js
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
[downloads-image]: https://img.shields.io/npm/dm/lead.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/lead
[npm-image]: https://img.shields.io/npm/v/lead.svg?style=flat-square[ci-url]: https://github.com/gulpjs/lead/actions?query=workflow:dev
[ci-image]: https://img.shields.io/github/actions/workflow/status/gulpjs/lead/dev.yml?branch=master&style=flat-square[coveralls-url]: https://coveralls.io/r/gulpjs/lead
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/lead/master.svg?style=flat-square