fox-send/server/streamparser.js

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;