Socket
Book a DemoInstallSign in
Socket

pipe-streams-to-promise

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pipe-streams-to-promise

Pipe an array of streams to a single promise. Captures errors on any of the streams.

latest
Source
npmnpm
Version
0.2.0
Version published
Weekly downloads
1K
-14.81%
Maintainers
1
Weekly downloads
 
Created
Source

pipe-streams-to-promise

Pipes an array of streams together and returns a promise. Checks for any errors on the steams.

Heavily inspired by, and test cases taken from, epeli's promisePipe

Usage

var pipeStreams = require('pipe-streams-to-promise');

var fs = require('fs');
var zlib = require('zlib');

var gzip = zlib.createGzip();
var readStream = fs.createReadStream('myfile.txt');
var writeStream = fs.createWriteStream('myfile.txt.gz');


pipeStreams([
  readStream,
  gzip,
  writeStream
]).then(function(writeStream) {
  console.log('Done compressing.');
}).catch(function(err) {
  console.error('Ran into an error:', err);
});

Keywords

streams

FAQs

Package last updated on 11 Apr 2016

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