mirror of
https://gitlab.com/timvisee/send.git
synced 2024-11-13 22:54:15 +01:00
16 lines
298 B
JavaScript
16 lines
298 B
JavaScript
const { Duplex } = require('stream');
|
|
|
|
class StreamParser extends Duplex {
|
|
_write(chunk, encoding, callback) {
|
|
if (chunk.byteLength === 1 && chunk[0] === 0) {
|
|
this.push(null);
|
|
} else {
|
|
this.push(chunk);
|
|
}
|
|
callback();
|
|
}
|
|
_read() {}
|
|
}
|
|
|
|
module.exports = StreamParser;
|