Emit correct event
This commit is contained in:
parent
2bbc5c9e0f
commit
ce2bb55b24
@ -1,4 +1,4 @@
|
||||
import { DuplexOptions, Duplex, Transform } from "stream";
|
||||
import { DuplexOptions, Duplex, Transform, Writable } from "stream";
|
||||
|
||||
import { isReadable } from "../helpers";
|
||||
|
||||
@ -48,10 +48,11 @@ class Demux extends Duplex {
|
||||
...options,
|
||||
transform: (d, _, cb) => {
|
||||
this.push(d);
|
||||
cb(null, d);
|
||||
cb(null);
|
||||
},
|
||||
});
|
||||
this.once("unpipe", () => this._flush());
|
||||
|
||||
this.on("unpipe", () => this._flush());
|
||||
}
|
||||
|
||||
public _read(size: number) {}
|
||||
@ -87,7 +88,7 @@ class Demux extends Duplex {
|
||||
totalEnded++;
|
||||
if (pipelines.length === totalEnded) {
|
||||
this.push(null);
|
||||
this.emit("finished");
|
||||
this.emit("end");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -724,7 +724,7 @@ test.cb("Demux should send data events", t => {
|
||||
});
|
||||
});
|
||||
|
||||
test.cb("demux() `finish` and `end` propagates", t => {
|
||||
test.cb.only("demux() `finish` and `end` propagates", t => {
|
||||
interface Chunk {
|
||||
key: string;
|
||||
mapped: number[];
|
||||
|
Loading…
Reference in New Issue
Block a user