decode seems to work now

This commit is contained in:
Moon Man 2024-01-28 09:02:33 -05:00
parent e41193e489
commit 05c7599696
2 changed files with 2 additions and 2 deletions

2
dist/bert.js vendored
View File

@ -95,7 +95,7 @@ export class Bert {
if (buffer[0] !== Types.BERT_START) { if (buffer[0] !== Types.BERT_START) {
throw new Error("Not a valid BERT"); throw new Error("Not a valid BERT");
} }
const obj = this.#decode(Buffer.from(buffer, 1)); const obj = this.#decode(buffer.subarray(1));
if (obj.rest.length !== 0) { if (obj.rest.length !== 0) {
throw new Error("Invalid BERT"); throw new Error("Invalid BERT");
} }

View File

@ -115,7 +115,7 @@ export class Bert {
throw new Error("Not a valid BERT"); throw new Error("Not a valid BERT");
} }
const obj = this.#decode(Buffer.from(buffer, 1)); const obj = this.#decode(buffer.subarray(1));
if (obj.rest.length !== 0) { if (obj.rest.length !== 0) {
throw new Error("Invalid BERT"); throw new Error("Invalid BERT");