Socket
Socket
Sign inDemoInstall

merge-stream

Package Overview
Dependencies
7
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    merge-stream

Create a stream that emits events from multiple other streams


Version published
Weekly downloads
31M
decreased by-9.38%
Maintainers
1
Install size
122 kB
Created
Weekly downloads
 

Package description

What is merge-stream?

The merge-stream npm package is used to create a stream that emits events from multiple other streams. This is useful when you want to handle multiple streams as if they were a single stream, for example, when you are dealing with multiple sources of data or tasks in a build process.

What are merge-stream's main functionalities?

Merging multiple streams

This feature allows you to merge multiple streams into one. In the code sample, `stream1` and `stream2` are merged into `mergedStream`. You can then listen to events from `mergedStream` as if it was a single stream.

var stream1 = source1.pipe(transform1);
var stream2 = source2.pipe(transform2);
var mergedStream = mergeStream(stream1, stream2);
mergedStream.on('data', function(data) {
  console.log(data);
});

Adding streams dynamically

This feature allows you to add streams to the merged stream dynamically. Initially, `mergedStream` is created without any sources. Streams `stream1` and `stream2` are then created and added to `mergedStream` dynamically.

var mergedStream = mergeStream();

var stream1 = source1.pipe(transform1);
mergedStream.add(stream1);

var stream2 = source2.pipe(transform2);
mergedStream.add(stream2);

Other packages similar to merge-stream

Readme

Source

merge-stream

Merge (interleave) a bunch of streams.

build status

Synopsis

var stream1 = new Stream();
var stream2 = new Stream();

var merged = mergeStream(stream1, stream2);

var stream3 = new Stream();
merged.add(stream3);

Description

This is the merge function from event-stream separated into a new module and given an add method so you can dynamically add more sources to the stream.

License

MIT

FAQs

Last updated on 06 Jul 2014

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