Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

combined-stream

Package Overview
Dependencies
Maintainers
3
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

combined-stream

A stream that emits multiple other streams one after another.

  • 0.0.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
27M
decreased by-41.79%
Maintainers
3
Weekly downloads
 
Created

What is combined-stream?

The combined-stream npm package is used to create a stream that emits events from multiple other streams in sequence. It is useful for treating a series of streams as a single continuous stream, which can be particularly handy when dealing with file uploads, data concatenation, or stream transformation.

What are combined-stream's main functionalities?

Creating a combined stream from multiple sources

This feature allows you to combine multiple readable streams into one. In the code sample, two text files are read as streams and appended to the combined stream, which is then piped to the standard output.

const CombinedStream = require('combined-stream');
const fs = require('fs');

const combinedStream = CombinedStream.create();
combinedStream.append(fs.createReadStream('file1.txt'));
combinedStream.append(fs.createReadStream('file2.txt'));

combinedStream.pipe(process.stdout);

Appending streams with delayed execution

This feature allows you to append streams with a function that will be called when the stream is ready for more data. The code sample demonstrates appending a stream with a function that provides the stream asynchronously.

const CombinedStream = require('combined-stream');
const fs = require('fs');

const combinedStream = CombinedStream.create();
combinedStream.append(next => {
  next(fs.createReadStream('file3.txt'));
});

combinedStream.pipe(process.stdout);

Appending data directly

This feature allows you to append raw data directly to the combined stream. The code sample shows how to append string data to the stream, which is then piped to the standard output.

const CombinedStream = require('combined-stream');

const combinedStream = CombinedStream.create();
combinedStream.append('Hello ');
combinedStream.append('World!');

combinedStream.pipe(process.stdout);

Other packages similar to combined-stream

FAQs

Package last updated on 31 Oct 2014

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc