Server : nginx/1.20.1 System : Linux ccpf-production-2021 5.4.0-148-generic #165-Ubuntu SMP Tue Apr 18 08:53:12 UTC 2023 x86_64 User : forge ( 1000) PHP Version : 7.4.21 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /lib/node_modules/gulp/node_modules/to-through/ |
<p align="center">
<a href="http://gulpjs.com">
<img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
</a>
</p>
# to-through
[![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]
Wrap a ReadableStream in a TransformStream.
## Usage
```js
var from = require('from2');
var concat = require('concat-stream');
var toThrough = require('to-through');
var readable = from([' ', 'hello', ' ', 'world']);
// Can be used as a Readable or Transform
var maybeTransform = toThrough(readable);
from(['hi', ' ', 'there', ','])
.pipe(maybeTransform)
.pipe(concat(function(result) {
// result.toString() === 'hi there, hello world'
}));
```
## API
### `toThrough(readableStream)`
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).
## License
MIT
[downloads-image]: http://img.shields.io/npm/dm/to-through.svg
[npm-url]: https://npmjs.com/package/to-through
[npm-image]: http://img.shields.io/npm/v/to-through.svg
[travis-url]: https://travis-ci.org/gulpjs/to-through
[travis-image]: http://img.shields.io/travis/gulpjs/to-through.svg?label=travis-ci
[appveyor-url]: https://ci.appveyor.com/project/gulpjs/to-through
[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/to-through.svg?label=appveyor
[coveralls-url]: https://coveralls.io/r/gulpjs/to-through
[coveralls-image]: http://img.shields.io/coveralls/gulpjs/to-through/master.svg
[gitter-url]: https://gitter.im/gulpjs/gulp
[gitter-image]: https://badges.gitter.im/gulpjs/gulp.png