feat: support compression when importing/exporting events (gzip/xz)#514
Merged
cameri merged 14 commits intocameri:mainfrom Apr 19, 2026
Merged
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
a20e5ba to
1161d88
Compare
Collaborator
1161d88 to
f048f9f
Compare
There was a problem hiding this comment.
Pull request overview
Adds streaming gzip/xz compression support to the event import/export CLIs while preserving the existing JSONL-based workflow, improving portability and storage/transfer efficiency for large exports.
Changes:
- Introduces
src/utils/compression.tswith format parsing, detection (extension + magic bytes), and streaming (de)compression helpers. - Updates
export-eventsto optionally compress output, add CLI flags, and print end-of-run size/throughput metrics. - Updates
import-eventsto auto-detect compressed inputs and decompress on-the-fly; adds unit + integration coverage and docs.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/utils/compression.ts |
New shared compression utilities (format parsing, detection, gzip/xz streams, xz tuning). |
src/scripts/export-events.ts |
Adds compression flags, streaming compression pipeline, and export metrics/usage handling. |
src/import-events.ts |
Removes .jsonl-only restriction; adds compression auto-detection + decompression stream creation and updated CLI parsing/help. |
src/services/event-import-service.ts |
Refactors importer to accept a readable stream (importFromReadable) and keeps file-path import as a wrapper. |
test/unit/utils/compression.spec.ts |
Unit tests for compression helpers, detection, env tuning, and stream round-trips. |
test/unit/scripts/export-events.spec.ts |
Unit tests for export CLI arg parsing and metrics formatting helpers. |
test/unit/import-events.spec.ts |
Unit tests for import CLI arg parsing and updated error cases. |
test/unit/services/event-import-service.spec.ts |
Adds coverage for importing from a readable stream. |
test/integration/features/compression/compression-roundtrip.feature |
New cucumber feature for gzip/xz export+import roundtrip. |
test/integration/features/compression/compression-roundtrip.feature.ts |
Step definitions to seed DB, run CLIs, and verify roundtrip restore. |
README.md |
Documents compressed import support, export compression flags, and xz tuning env vars. |
package.json |
Adds lzma-native dependency for xz support. |
package-lock.json |
Locks lzma-native and related transitive dependencies. |
.knip.json |
Ignores lzma-native dependency (used via dynamic require). |
.changeset/quick-maps-marry.md |
Changeset documenting the new compression feature. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cameri
reviewed
Apr 19, 2026
Owner
|
@Anshumancanrock how did you manually test this? |
Collaborator
Author
|
Hi @cameri , so I tested this locally before submitting.
It looked solid on my side, happy to dig into anything specific if you want. |
…t-export-compression
11ececc to
46d1eac
Compare
46d1eac to
11ececc
Compare
cameri
approved these changes
Apr 19, 2026
This was referenced Apr 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds practical compression support to event import/export, without changing the existing JSONL workflow.
Related Issue
Closes #407
Motivation and Context
People already compress exported event files for storage and transfer. This change removes the manual steps around that and keeps the flow memory-safe by streaming throughout.
How Has This Been Tested?
Tested locally on Linux.
Screenshots (if appropriate):
N/A (CLI/backend changes)
Types of changes
Checklist: