Handle backpressure

This commit is contained in:
Jerry Kurian
2019-08-30 09:33:29 -04:00
parent 2524d51aa7
commit fe0e53147c
4 changed files with 105 additions and 8 deletions

View File

@@ -14,6 +14,7 @@ export function map<T, R>(
writableObjectMode: true,
},
): Transform {
// remove try catch
return new Transform({
...options,
async transform(chunk: T, encoding, callback) {
@@ -22,6 +23,7 @@ export function map<T, R>(
this.push(mapped);
callback();
} catch (err) {
console.log("caught error", err.message);
callback(err);
}
},