wrong len len
This commit is contained in:
parent
af00baa6bc
commit
cd8fef7817
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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),
|
||||||
|
|
Loading…
Reference in New Issue