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