Skip to content
Wrap a ReadableStream in a TransformStream.
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.editorconfig Build: Enforce consistent line endings Aug 19, 2017
.eslintrc
.gitattributes
.gitignore Scaffold: Repository creation May 2, 2017
.jscsrc Scaffold: Repository creation May 2, 2017
.travis.yml
LICENSE Scaffold: Repository creation May 2, 2017
README.md Docs: Add badges, example and API May 3, 2017
appveyor.yml Scaffold: Repository creation May 2, 2017
index.js
package.json Release: 2.0.0 May 3, 2017

README.md

to-through

NPM version Downloads Build Status AppVeyor Build Status Coveralls Status Gitter chat

Wrap a ReadableStream in a TransformStream.

Usage

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

You can’t perform that action at this time.