From e476391eeee0cac64d4158e110548b6ae7d8bbe7 Mon Sep 17 00:00:00 2001 From: Akkuman Date: Tue, 24 Mar 2026 05:37:37 +0000 Subject: [PATCH] fix: autoclose stream --- dist/index.js | 16 ++++++++-------- main.js | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/dist/index.js b/dist/index.js index 25b43a3..6e476e7 100644 --- a/dist/index.js +++ b/dist/index.js @@ -48266,17 +48266,17 @@ function paths(patterns) { }; async function createStreamableFile(fpath) { - const name = external_path_.basename(fpath); - const handle = await promises_namespaceObject.open(fpath); - const { size } = await handle.stat(); + const name = external_path_.basename(fpath); + const handle = await promises_namespaceObject.open(fpath); + const { size } = await handle.stat(); - const file = new external_buffer_.File([], name); - file.stream = () => handle.readableWebStream(); + const file = new external_buffer_.File([], name); + file.stream = () => handle.readableWebStream({autoClose: true}); - // Set correct size otherwise, fetch will encounter UND_ERR_REQ_CONTENT_LENGTH_MISMATCH - Object.defineProperty(file, 'size', { get: () => size }); + // Set correct size otherwise, fetch will encounter UND_ERR_REQ_CONTENT_LENGTH_MISMATCH + Object.defineProperty(file, 'size', { get: () => size }); - return file; + return file; } diff --git a/main.js b/main.js index f93d799..07d23fb 100644 --- a/main.js +++ b/main.js @@ -128,17 +128,17 @@ function paths(patterns) { }; async function createStreamableFile(fpath) { - const name = path.basename(fpath); - const handle = await asyncfs.open(fpath); - const { size } = await handle.stat(); + const name = path.basename(fpath); + const handle = await asyncfs.open(fpath); + const { size } = await handle.stat(); - const file = new File([], name); - file.stream = () => handle.readableWebStream(); + const file = new File([], name); + file.stream = () => handle.readableWebStream({autoClose: true}); - // Set correct size otherwise, fetch will encounter UND_ERR_REQ_CONTENT_LENGTH_MISMATCH - Object.defineProperty(file, 'size', { get: () => size }); + // Set correct size otherwise, fetch will encounter UND_ERR_REQ_CONTENT_LENGTH_MISMATCH + Object.defineProperty(file, 'size', { get: () => size }); - return file; + return file; }