Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Aug 24, 2023
1 parent eb650d4 commit a0611e9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/util.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const stream = require('stream');
const pump = require('pump');

// impl promise pipeline on Node.js 14
const pipelinePromise = stream.promises?.pipeline ?? function pipeline(...args) {
return new Promise((resolve, reject) => {
pump(...args, err => {
if (err) return reject(err);
resolve();
});
});
};

exports.pipelinePromise = pipelinePromise;

0 comments on commit a0611e9

Please sign in to comment.