diff --git a/dist/index.js b/dist/index.js index 6e476e7..93037c5 100644 --- a/dist/index.js +++ b/dist/index.js @@ -48271,7 +48271,8 @@ async function createStreamableFile(fpath) { const { size } = await handle.stat(); const file = new external_buffer_.File([], name); - file.stream = () => handle.readableWebStream({autoClose: true}); + file.stream = () => handle.readableWebStream(); + file.close = async () => await handle?.close(); // Set correct size otherwise, fetch will encounter UND_ERR_REQ_CONTENT_LENGTH_MISMATCH Object.defineProperty(file, 'size', { get: () => size }); @@ -48374,6 +48375,7 @@ async function uploadFiles(client, owner, repo, release_id, all_files, params) { attachment: curfile, name: external_path_.basename(filepath), }) + await curfile.close(); let algorithms = []; if (params.md5sum) { algorithms = algorithms.concat('md5'); @@ -48385,6 +48387,7 @@ async function uploadFiles(client, owner, repo, release_id, all_files, params) { if (algorithms.length !== 0) { curfile = await createStreamableFile(filepath) hashes = await calculateMultipleHashes(curfile, algorithms) + await curfile.close(); } if (params.md5sum) { let hash = hashes.md5; diff --git a/main.js b/main.js index 07d23fb..3ad37f5 100644 --- a/main.js +++ b/main.js @@ -133,7 +133,8 @@ async function createStreamableFile(fpath) { const { size } = await handle.stat(); const file = new File([], name); - file.stream = () => handle.readableWebStream({autoClose: true}); + file.stream = () => handle.readableWebStream(); + file.close = async () => await handle?.close(); // Set correct size otherwise, fetch will encounter UND_ERR_REQ_CONTENT_LENGTH_MISMATCH Object.defineProperty(file, 'size', { get: () => size }); @@ -236,6 +237,7 @@ async function uploadFiles(client, owner, repo, release_id, all_files, params) { attachment: curfile, name: path.basename(filepath), }) + await curfile.close(); let algorithms = []; if (params.md5sum) { algorithms = algorithms.concat('md5'); @@ -247,6 +249,7 @@ async function uploadFiles(client, owner, repo, release_id, all_files, params) { if (algorithms.length !== 0) { curfile = await createStreamableFile(filepath) hashes = await calculateMultipleHashes(curfile, algorithms) + await curfile.close(); } if (params.md5sum) { let hash = hashes.md5;