Latest Socket ResearchMalicious Chrome Extension Performs Hidden Affiliate Hijacking.Details
Socket
Book a DemoInstallSign in
Socket

streamcat

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

streamcat

Concatenate ReadStreams and Buffers!

npmnpm
Version
2.2.3
Version published
Weekly downloads
6
500%
Maintainers
1
Weekly downloads
 
Created
Source

streamcat

Concatenate Node JS ReadStreams!

Usage

Example, print the contents of myfileA followed by myfileB, this is equivalent to using cat(1): cat myfileA myfileB.

var streamCat = require('streamcat');

streamCat([
	fs.createReadStream('myfileA'),
	fs.createReadStream('myfileB')
]).pipe(process.stdout);

API

streamCat(listOfStreamsOrBuffers)

streamCat will take a list of ReadStreams, Buffers, or Promises returning a ReadStream or Buffer as its only argument and returns a ReadStream that will stream the concatenation of each item in the list.

You can mix Buffer, ReadStream, and Promise usage, in this instance, the String "Some content" will be streamed between myfileA and myfileB:

streamCat([
	fs.createReadStream('myfileA'),
	new Buffer("Some content"),
	fs.createReadStream('myfileB')
]).pipe(process.stdout);

Example using Promises that has the same result as the above example, the value in the Promise is resolved asynchronously:

streamCat([
	fs.createReadStream('myfileA'),
	Promise.resolve(new Buffer("Some content")),
	fs.createReadStream('myfileB')
]).pipe(process.stdout);

License

MIT

Keywords

streams

FAQs

Package last updated on 19 May 2015

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