Update demux

This commit is contained in:
Jerry Kurian
2019-11-27 16:55:13 -05:00
parent 9b31479406
commit c690185ab7
2 changed files with 3 additions and 3 deletions

View File

@@ -51,10 +51,10 @@ class Demux extends Writable {
this.streamsByKey = {};
}
public _write(chunk: any, encoding: any, cb: any) {
public async _write(chunk: any, encoding: any, cb: any) {
const destKey = this.demuxer(chunk);
if (this.streamsByKey[destKey] === undefined) {
this.streamsByKey[destKey] = this.construct(destKey);
this.streamsByKey[destKey] = await this.construct(destKey);
}
if (!this.streamsByKey[destKey].write(chunk, encoding)) {
this.streamsByKey[destKey].once("drain", () => {