1
0
mirror of https://gitlab.com/timvisee/send.git synced 2024-11-10 13:13:00 +01:00
send/server/streamparser.js
2018-06-25 14:27:56 -07:00

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;