1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.writableVoid = void 0;
|
4 | const node_stream_1 = require("node:stream");
|
5 | /**
|
6 | * Use as a "null-terminator" of stream.pipeline.
|
7 | * It consumes the stream as quickly as possible without doing anything.
|
8 | * Put it in the end of your pipeline in case it ends with Transform that needs a consumer.
|
9 | */
|
10 | function writableVoid(opt = {}) {
|
11 | return new node_stream_1.Writable({
|
12 | objectMode: true,
|
13 | ...opt,
|
14 | write(chunk, _, cb) {
|
15 | cb();
|
16 | },
|
17 | final(cb) {
|
18 | cb();
|
19 | opt.streamDone?.resolve();
|
20 | },
|
21 | });
|
22 | }
|
23 | exports.writableVoid = writableVoid;
|