Skip to content

Conversation

@rcooke-warwick
Copy link
Contributor

balena-os/leviathan-worker#101 - corresponding worker PR with context
Change-type: patch

async flash(imagePath) {

this.logger.log(`Gzipping image...`);
await exec(`gzip ${imagePath}`);
Copy link
Member

@vipulgupta2048 vipulgupta2048 Feb 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding another OS dependency I was thinking if the entire problem is gzipping in the request causes a timeout then why not use the same logic to gzip out of the request something like

Create a temp file

pipeline(
  fs.createReadStream(imagePath),
  createGzip({ level: 6 }),
  tempFile
)
                         
await move(tempfile, imagePath) // https://stackoverflow.com/a/34499859 

This should also unlink/overrwite the image on imagePath

Change-type: patch
Signed-off-by: Ryan Cooke <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants