Debian Codegraph @

to-through/README.md

raw
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
7 # to-through
8
9 [![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]
10
11 Wrap a ReadableStream in a TransformStream.
12
13 ## Usage
14
15 ```js
16 var from = require('from2');
17 var concat = require('concat-stream');
18 var toThrough = require('to-through');
19
20 var readable = from([' ', 'hello', ' ', 'world']);
21
22 // Can be used as a Readable or Transform
23 var maybeTransform = toThrough(readable);
24
25 from(['hi', ' ', 'there', ','])
26 .pipe(maybeTransform)
27 .pipe(concat(function(result) {
28 // result.toString() === 'hi there, hello world'
29 }));
30 ```
31
32 ## API
33
34 ### `toThrough(readableStream)`
35
36 Takes a `readableStream` as the only argument and returns a `through2` stream. If the returned stream is piped before `nextTick`, the wrapped `readableStream` will not flow until the upstream is flushed. If the stream is not piped before `nextTick`, it is ended and flushed (acting as a proper readable).
37
38 ## License
39
40 MIT
41
42 [downloads-image]: http://img.shields.io/npm/dm/to-through.svg
43 [npm-url]: https://npmjs.com/package/to-through
44 [npm-image]: http://img.shields.io/npm/v/to-through.svg
45
46 [travis-url]: https://travis-ci.org/gulpjs/to-through
47 [travis-image]: http://img.shields.io/travis/gulpjs/to-through.svg?label=travis-ci
48
49 [appveyor-url]: https://ci.appveyor.com/project/gulpjs/to-through
50 [appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/to-through.svg?label=appveyor
51
52 [coveralls-url]: https://coveralls.io/r/gulpjs/to-through
53 [coveralls-image]: http://img.shields.io/coveralls/gulpjs/to-through/master.svg
54
55 [gitter-url]: https://gitter.im/gulpjs/gulp
56 [gitter-image]: https://badges.gitter.im/gulpjs/gulp.png