UNPKG

591 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.writablePushToArray = void 0;
4const stream_1 = require("stream");
5/**
6 * Will push all results to `arr`, will emit nothing in the end.
7 */
8function writablePushToArray(arr, opt = {}) {
9 return new stream_1.Writable({
10 objectMode: true,
11 ...opt,
12 write(chunk, _encoding, cb) {
13 arr.push(chunk);
14 // callback to signal that we processed input, but not emitting any output
15 cb();
16 },
17 });
18}
19exports.writablePushToArray = writablePushToArray;