fix: autoclose stream

This commit is contained in:
Akkuman
2026-03-24 05:37:37 +00:00
parent fd3cba014c
commit e476391eee
2 changed files with 16 additions and 16 deletions

16
dist/index.js vendored
View File

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