UNPKG

@naturalcycles/nodejs-lib

Version:
20 lines (19 loc) 583 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.writablePushToArray = void 0; const stream_1 = require("stream"); /** * Will push all results to `arr`, will emit nothing in the end. */ function writablePushToArray(arr, opt = {}) { return new stream_1.Writable({ objectMode: true, ...opt, write(chunk, _, cb) { arr.push(chunk); // callback to signal that we processed input, but not emitting any output cb(); }, }); } exports.writablePushToArray = writablePushToArray;