Skip to content

Commit

Permalink
gzip before sending
Browse files Browse the repository at this point in the history
Change-type: patch
Signed-off-by: Ryan Cooke <[email protected]>
  • Loading branch information
rcooke-warwick committed Feb 8, 2024
1 parent 62acfb3 commit 95f9a90
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions core/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
vim \
build-essential \
make \
gzip \
python && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
Expand Down
8 changes: 6 additions & 2 deletions core/lib/common/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ module.exports = class Worker {
* @category helper
*/
async flash(imagePath) {

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

let attempt = 0;
await retry(
async () => {
Expand Down Expand Up @@ -187,9 +191,9 @@ module.exports = class Worker {
}
});

// append .gz extension as we zipped it above
pipeline(
fs.createReadStream(imagePath),
createGzip({ level: 6 }),
fs.createReadStream(`${imagePath}.gz`),
req,
);
});
Expand Down

0 comments on commit 95f9a90

Please sign in to comment.