wrong len len

This commit is contained in:
Moon Man 2024-02-03 00:55:55 -05:00
parent af00baa6bc
commit cd8fef7817
2 changed files with 2 additions and 2 deletions

2
dist/main.js vendored
View File

@ -32,7 +32,7 @@ export class DumbPort extends Duplex {
_write(obj, encodingOrCallback, callback) { _write(obj, encodingOrCallback, callback) {
const actualCallback = callback || typeof encodingOrCallback === "function" ? encodingOrCallback : undefined; const actualCallback = callback || typeof encodingOrCallback === "function" ? encodingOrCallback : undefined;
if (Buffer.isBuffer(obj)) { if (Buffer.isBuffer(obj)) {
this.buf.writeUInt32BE(obj.byteLength); this.buf.writeUInt16BE(obj.byteLength);
obj.copy(this.buf, DumbPort.LEN_LEN); obj.copy(this.buf, DumbPort.LEN_LEN);
process.stdout.write(this.buf.subarray(0, obj.byteLength + DumbPort.LEN_LEN), actualCallback); process.stdout.write(this.buf.subarray(0, obj.byteLength + DumbPort.LEN_LEN), actualCallback);
} }

View File

@ -42,7 +42,7 @@ export class DumbPort extends Duplex {
const actualCallback: any = callback || typeof encodingOrCallback === "function" ? encodingOrCallback : undefined; const actualCallback: any = callback || typeof encodingOrCallback === "function" ? encodingOrCallback : undefined;
if (Buffer.isBuffer(obj)) { if (Buffer.isBuffer(obj)) {
this.buf.writeUInt32BE(obj.byteLength); this.buf.writeUInt16BE(obj.byteLength);
obj.copy(this.buf, DumbPort.LEN_LEN); obj.copy(this.buf, DumbPort.LEN_LEN);
process.stdout.write( process.stdout.write(
this.buf.subarray(0, obj.byteLength + DumbPort.LEN_LEN), this.buf.subarray(0, obj.byteLength + DumbPort.LEN_LEN),