diff --git a/packages/file/src/adapter/node.ts b/packages/file/src/adapter/node.ts index ecf856c..ad54868 100644 --- a/packages/file/src/adapter/node.ts +++ b/packages/file/src/adapter/node.ts @@ -10,6 +10,8 @@ export async function loadFile(url: string): Promise { if (url.startsWith('file://')) { const data = await readFile(fileURLToPath(url)) const result = await fromBuffer(data) - return { mime: result?.mime, filename: basename(url), data } + // https://stackoverflow.com/questions/8609289/convert-a-binary-nodejs-buffer-to-javascript-arraybuffer#answer-31394257 + const buffer = data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength) + return { mime: result?.mime, filename: basename(url), data: buffer } } }