From edae435ac4b40e5058d134defffc874ead81b130 Mon Sep 17 00:00:00 2001 From: "agent-think[bot]" Date: Fri, 21 Aug 2026 19:13:49 +0000 Subject: [PATCH] dofs: Defer committed inode reads (#115) ReadableStream's default queue can pull a chunk as soon as the stream is created. Use a zero high water mark so blob reads begin only when a consumer requests data across both supported stream runtimes. --- packages/dofs/src/fs/readFile.ts | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/dofs/src/fs/readFile.ts b/packages/dofs/src/fs/readFile.ts index e5c16bab..a8b5d4fc 100644 --- a/packages/dofs/src/fs/readFile.ts +++ b/packages/dofs/src/fs/readFile.ts @@ -156,16 +156,19 @@ export function readCommittedFileByInode( assertDenseRange(chunks, 0, lastIdx, path); let index = 0; - return new ReadableStream({ - pull(controller) { - if (index >= chunks.length) { - controller.close(); - return; - } - const chunk = chunks[index++]; - controller.enqueue(rangedChunkBytes(db, path, chunk, 0, size)); + return new ReadableStream( + { + pull(controller) { + if (index >= chunks.length) { + controller.close(); + return; + } + const chunk = chunks[index++]; + controller.enqueue(rangedChunkBytes(db, path, chunk, 0, size)); + }, }, - }); + { highWaterMark: 0 }, + ); } function validateReadWindow(