From e2b7d083a1435a0f462d88e6e4b6cc12463b3674 Mon Sep 17 00:00:00 2001 From: Jim Robinson <933148+jrobinso@users.noreply.github.com> Date: Mon, 14 Oct 2024 08:03:20 -0700 Subject: [PATCH] Fix problem decoding tag array of type "B,C" (#143) --- src/cramFile/slice/decodeRecord.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cramFile/slice/decodeRecord.ts b/src/cramFile/slice/decodeRecord.ts index 1296e3eb..2a0d8b34 100644 --- a/src/cramFile/slice/decodeRecord.ts +++ b/src/cramFile/slice/decodeRecord.ts @@ -32,7 +32,10 @@ function readNullTerminatedString(buffer: Uint8Array) { */ function parseTagValueArray(buffer: Uint8Array) { const arrayType = String.fromCharCode(buffer[0]!) - const length = Int32Array.from(buffer.slice(1))[0]! + + const dataView = new DataView(buffer.buffer) + const littleEndian = true + const length = dataView.getUint32(1, littleEndian) const array: number[] = new Array(length) buffer = buffer.slice(5)