From 611e3711c69e8a262360e7feb6ca93aee550bfff Mon Sep 17 00:00:00 2001 From: Hexagon Date: Sat, 15 Jun 2024 22:20:58 +0200 Subject: [PATCH] Fix for Node.js --- CHANGELOG.md | 4 ++++ deno.json | 2 +- src/lib/utils/file.ts | 5 ++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d39c1a7..161668a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.16.1 + +- Fix for Node.js not treating subarrays of buffers as expected + ## 0.16.0 **Breaking change, databases created using earlier versions is not compatible diff --git a/deno.json b/deno.json index d0ba13a..2ebe3b5 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "name": "@cross/kv", - "version": "0.16.0", + "version": "0.16.1", "exports": { ".": "./mod.ts", "./cli": "./src/cli/mod.ts" diff --git a/src/lib/utils/file.ts b/src/lib/utils/file.ts index 10bf18c..efb065f 100644 --- a/src/lib/utils/file.ts +++ b/src/lib/utils/file.ts @@ -73,10 +73,9 @@ export async function readAtPosition( 0, length, position, - // deno-lint-ignore no-explicit-any - ) as FileReadResult; + ) as FileReadResult; const bytesRead = readResult.bytesRead as number; - return buffer.subarray(0, bytesRead); + return new Uint8Array(buffer.buffer, 0, bytesRead); } }