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; }