From 05c75996965592f29f53ee8c2545e5497de49ab1 Mon Sep 17 00:00:00 2001 From: Moon Man Date: Sun, 28 Jan 2024 09:02:33 -0500 Subject: [PATCH] decode seems to work now --- dist/bert.js | 2 +- src/bert.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/bert.js b/dist/bert.js index 369d97a..f5384d5 100644 --- a/dist/bert.js +++ b/dist/bert.js @@ -95,7 +95,7 @@ export class Bert { if (buffer[0] !== Types.BERT_START) { 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) { throw new Error("Invalid BERT"); } diff --git a/src/bert.ts b/src/bert.ts index 6592cf7..777f00d 100644 --- a/src/bert.ts +++ b/src/bert.ts @@ -115,7 +115,7 @@ export class 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) { throw new Error("Invalid BERT");