atom wrong subarray

This commit is contained in:
Moon Man 2024-01-28 18:59:29 -05:00
parent 6cdfca4363
commit d89fcfb76f
2 changed files with 2 additions and 2 deletions

2
dist/bert.js vendored
View File

@ -254,7 +254,7 @@ export class Bert {
}; };
decode_atom = (buffer, count) => { decode_atom = (buffer, count) => {
const size = this.bytesToInt(buffer, count, true); const size = this.bytesToInt(buffer, count, true);
buffer = Buffer.from(buffer, count); buffer = buffer.subarray(count);
let value = buffer.toString("utf8", 0, size); let value = buffer.toString("utf8", 0, size);
if (value === "true") { if (value === "true") {
value = true; value = true;

View File

@ -299,7 +299,7 @@ export class Bert {
decode_atom = (buffer: Buffer, count: 1 | 2 | 4) => { decode_atom = (buffer: Buffer, count: 1 | 2 | 4) => {
const size = this.bytesToInt(buffer, count, true); const size = this.bytesToInt(buffer, count, true);
buffer = Buffer.from(buffer, count); buffer = buffer.subarray(count);
let value: any = buffer.toString("utf8", 0, size); let value: any = buffer.toString("utf8", 0, size);
if (value === "true") { if (value === "true") {
value = true; value = true;