decode seems to work now
This commit is contained in:
parent
e41193e489
commit
05c7599696
|
@ -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");
|
||||||
}
|
}
|
||||||
|
|
|
@ -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");
|
||||||
|
|
Loading…
Reference in New Issue