1. to-through
Wrap a Readable stream in a Transform stream.
to-through
Package: to-through
Created by: gulpjs
Last modified: Wed, 07 Sep 2022 22:38:13 GMT
Version: 3.0.0
License: MIT
Downloads: 7,521,434
Repository: https://github.com/gulpjs/to-through

Install

npm install to-through
yarn add to-through

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

Dependencies

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code