Skip to content

refactor: Replace Gzip compression with LZ4 in file handling#1306

Draft
OmarBrbutovic wants to merge 1 commit intoedgehog-device-manager:mainfrom
OmarBrbutovic:lz4_compression
Draft

refactor: Replace Gzip compression with LZ4 in file handling#1306
OmarBrbutovic wants to merge 1 commit intoedgehog-device-manager:mainfrom
OmarBrbutovic:lz4_compression

Conversation

@OmarBrbutovic
Copy link
Copy Markdown
Collaborator

What this PR does / why we need it:

On MCU we have stricter resource requirements and having deflate to work is often difficult and inefficient.

Additional documentation e.g. usage docs, diagrams, reviewer notes, etc.:


Thanks for sending a pull request! If this is your first time, here are some tips for you:
  1. You can take a look at our developer guide for an introduction on Edgehog development!
  2. Make sure to read CONTRIBUTING.md and CODE_OF_CONDUCT.md
  3. If the PR is unfinished or you're actively working on it, mark it as draft

When fixing existing issues, use github's syntax to link your pull request to it

fixes #<issue number>

We also have a syntax to signal dependencies to other open pull requests

depends on #<pr number>
depends on https://github.com/...

In case of stacked PRs, you may add the PR number in the last commit's title instead:

gitGraph
    commit id: "Current master"
    branch feat1
    checkout feat1
    commit id: "feat: add something"
    commit id: "feat: add something else (#100)"
    branch feat2
    checkout feat2
    commit id: "refactor: do something"
    commit id: "fix: solve issue"
    commit id: "feat: add a feature (#101)"
    branch feat3
    checkout feat3
    commit id: "feat: feat without pr number"
Loading

@OmarBrbutovic OmarBrbutovic added the chore Maintenance chore label Mar 25, 2026
On MCU we have stricter resource requirements and having
deflate to work is often difficult and inefficient.

Signed-off-by: Omar <omar.brbutovic@secomind.com>
// Creates a tar.gz archive from multiple files.
// Creates an LZ4 compressed tar archive from multiple files.
// Returns a Blob of the compressed archive.
const createTarGzArchive = async (files: File[]): Promise<Blob> => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
const createTarGzArchive = async (files: File[]): Promise<Blob> => {
const createTarLz4Archive = async (files: File[]): Promise<Blob> => {


// Run compression on a later tick so callers can await it asynchronously.
const lz4Data = await new Promise<Uint8Array>((resolve) => {
setTimeout(() => resolve(compress(tarData)), 0);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove the setTimeout wrapper (it doesn’t make compression truly async).

@OmarBrbutovic OmarBrbutovic marked this pull request as draft April 1, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance chore

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants