to-through

Wrap a Readable stream in a Transform stream.

MIT 4 个版本
安装
npm install to-through
yarn add to-through
pnpm add to-through
bun add to-through
README

to-through

NPM version Downloads Build Status Coveralls Status

Wrap a Readable stream in a Transform stream.

Usage

var { Readable } = require('streamx');
var concat = require('concat-stream');
var toThrough = require('to-through');

var readable = Readable.from([' ', 'hello', ' ', 'world']);

// Can be used as a Readable or Transform
var maybeTransform = toThrough(readable);

Readable.from(['hi', ' ', 'there', ','])
  .pipe(maybeTransform)
  .pipe(
    concat(function (result) {
      // result === 'hi there, hello world'
    })
  );

API

toThrough(readableStream)

Takes a Readable stream as the only argument and returns a Transform stream wrapper. Any data piped into the Transform stream is piped passed along before any data from the wrapped Readable is injected into the stream.

License

MIT

版本列表
3.0.0 2022-09-07
2.0.0 2017-05-03
1.0.1 2017-05-03
1.0.0 2017-05-03