Skip to content

Commit

Permalink
use createReadStream
Browse files Browse the repository at this point in the history
  • Loading branch information
ggreif committed Jan 31, 2023
1 parent af306bd commit f2899b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function upload_to_release(release, file, asset_name, tag, overwrite, octokit) {
return;
}
const file_size = stat.size;
const file_bytes = fs.readFileSync(file).toString('binary');
const file_bytes = fs.createReadStream(file);
// Check for duplicates.
const assets = yield octokit.paginate(repoAssets, Object.assign(Object.assign({}, repo()), { release_id: release.data.id }));
const duplicate_asset = assets.find(a => a.name === asset_name);
Expand Down Expand Up @@ -9572,7 +9572,9 @@ function fetch(url, opts) {
return;
}

destroyStream(response.body, err);
if (response && response.body) {
destroyStream(response.body, err);
}
});

/* c8 ignore next 18 */
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async function upload_to_release(
return
}
const file_size = stat.size
const file_bytes = fs.readFileSync(file).toString('binary')
const file_bytes: any = fs.createReadStream(file)

// Check for duplicates.
const assets: RepoAssetsResp = await octokit.paginate(repoAssets, {
Expand Down

0 comments on commit f2899b4

Please sign in to comment.