Socket
Socket
Sign inDemoInstall

to-through

Package Overview
Dependencies
10
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    to-through

Wrap a ReadableStream in a TransformStream.


Version published
Maintainers
1
Install size
201 kB
Created

Changelog

Source

3.0.0 (2022-09-07)

⚠ BREAKING CHANGES

  • Switch to streamx (#9)
  • Upgrade scaffold, dropping node <10 support (#8)

Features

Miscellaneous Chores

  • Upgrade scaffold, dropping node <10 support (#8) (f095480)

Readme

Source

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

Keywords

FAQs

Last updated on 03 May 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc