pipe-streams-to-promise

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

MIT 2 个版本
安装
npm install pipe-streams-to-promise
yarn add pipe-streams-to-promise
pnpm add pipe-streams-to-promise
bun add pipe-streams-to-promise
README

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);
});
版本列表
0.2.0 2016-04-11
0.1.0 2015-03-12