Update demux
This commit is contained in:
parent
9b31479406
commit
c690185ab7
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@jogogo/mhysa",
|
||||
"version": "0.0.1-beta.2",
|
||||
"version": "0.0.1-beta.4",
|
||||
"description": "Streams and event emitter utils for Node.js",
|
||||
"keywords": [
|
||||
"promise",
|
||||
|
@ -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", () => {
|
||||
|
Loading…
Reference in New Issue
Block a user