mistake buffer slice
This commit is contained in:
parent
f0660ca220
commit
35c2763c31
|
@ -282,12 +282,12 @@ export class Bert {
|
|||
};
|
||||
decode_binary = (buffer) => {
|
||||
const size = this.bytesToInt(buffer, 4, true);
|
||||
buffer = Buffer.from(buffer, 4);
|
||||
buffer = buffer.subarray(4);
|
||||
const bin = Buffer.alloc(size);
|
||||
buffer.copy(bin, 0, 0, size);
|
||||
return {
|
||||
value: this.convention === Lang.ELIXIR && this.allBinariesAsString
|
||||
? bin.toString()
|
||||
? bin.toString("utf-8")
|
||||
: bin,
|
||||
rest: buffer.subarray(size),
|
||||
};
|
||||
|
|
|
@ -328,13 +328,13 @@ export class Bert {
|
|||
|
||||
decode_binary = (buffer: Buffer) => {
|
||||
const size = this.bytesToInt(buffer, 4, true);
|
||||
buffer = Buffer.from(buffer, 4);
|
||||
buffer = buffer.subarray(4);
|
||||
const bin = Buffer.alloc(size);
|
||||
buffer.copy(bin, 0, 0, size);
|
||||
return {
|
||||
value:
|
||||
this.convention === Lang.ELIXIR && this.allBinariesAsString
|
||||
? bin.toString()
|
||||
? bin.toString("utf-8")
|
||||
: bin,
|
||||
rest: buffer.subarray(size),
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue