mirror of
https://github.com/akkuman/gitea-release-action.git
synced 2026-03-26 13:00:48 +00:00
fix: autoclose stream
This commit is contained in:
16
dist/index.js
vendored
16
dist/index.js
vendored
@@ -48266,17 +48266,17 @@ function paths(patterns) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
async function createStreamableFile(fpath) {
|
async function createStreamableFile(fpath) {
|
||||||
const name = external_path_.basename(fpath);
|
const name = external_path_.basename(fpath);
|
||||||
const handle = await promises_namespaceObject.open(fpath);
|
const handle = await promises_namespaceObject.open(fpath);
|
||||||
const { size } = await handle.stat();
|
const { size } = await handle.stat();
|
||||||
|
|
||||||
const file = new external_buffer_.File([], name);
|
const file = new external_buffer_.File([], name);
|
||||||
file.stream = () => handle.readableWebStream();
|
file.stream = () => handle.readableWebStream({autoClose: true});
|
||||||
|
|
||||||
// Set correct size otherwise, fetch will encounter UND_ERR_REQ_CONTENT_LENGTH_MISMATCH
|
// Set correct size otherwise, fetch will encounter UND_ERR_REQ_CONTENT_LENGTH_MISMATCH
|
||||||
Object.defineProperty(file, 'size', { get: () => size });
|
Object.defineProperty(file, 'size', { get: () => size });
|
||||||
|
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
16
main.js
16
main.js
@@ -128,17 +128,17 @@ function paths(patterns) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
async function createStreamableFile(fpath) {
|
async function createStreamableFile(fpath) {
|
||||||
const name = path.basename(fpath);
|
const name = path.basename(fpath);
|
||||||
const handle = await asyncfs.open(fpath);
|
const handle = await asyncfs.open(fpath);
|
||||||
const { size } = await handle.stat();
|
const { size } = await handle.stat();
|
||||||
|
|
||||||
const file = new File([], name);
|
const file = new File([], name);
|
||||||
file.stream = () => handle.readableWebStream();
|
file.stream = () => handle.readableWebStream({autoClose: true});
|
||||||
|
|
||||||
// Set correct size otherwise, fetch will encounter UND_ERR_REQ_CONTENT_LENGTH_MISMATCH
|
// Set correct size otherwise, fetch will encounter UND_ERR_REQ_CONTENT_LENGTH_MISMATCH
|
||||||
Object.defineProperty(file, 'size', { get: () => size });
|
Object.defineProperty(file, 'size', { get: () => size });
|
||||||
|
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user