Skip to content

Commit

Permalink
Use create write stream
Browse files Browse the repository at this point in the history
  • Loading branch information
Hacksore committed Sep 22, 2024
1 parent 39be81b commit d07bac9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scripts/actions/upload-to-r2.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ async function uploadStableArtifacts({ github, context }) {
const stream = Readable.fromWeb(response.body)

console.log(`[${tag}] Writing stable artifact ${artifact.name}`);
await fs.promises.writeFile(path.join(releaseBinDir, `${artifact.name}`), stream);
const filePath = path.join(releaseBinDir, artifact.name);
const fileStream = fs.createWriteStream(filePath);
await new Promise((resolve, reject) => {
stream.pipe(fileStream);
stream.on('end', resolve);
stream.on('error', reject);
});
}

try {
Expand Down

0 comments on commit d07bac9

Please sign in to comment.