feat: transparently append to compressed archives
When appending to a compressed archive (gzip, brotli, zstd), the tool now handles compression automatically. Since some compression formats don't support appending to compressed files in place, we write a new compressed file with all the data and atomically rename it to replace the original (assuming there is enough space on that filesystem). This means you can work with compressed archives the same way as uncompressed ones. Point the tool at your .json.gz file and append values. No manual decompression/recompression needed.
This commit is contained in:
parent
da0fed29de
commit
2ab1c31993
34 changed files with 4747 additions and 1099 deletions
28
tests/compression-integration/generate_state.py
Executable file
28
tests/compression-integration/generate_state.py
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
Generate a JSON state file with N items in each array.
|
||||
Output goes to stdout.
|
||||
|
||||
Usage: ./generate_state.py <n>
|
||||
"""
|
||||
|
||||
import json
|
||||
import sys
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: generate_state.py <n>", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
n = int(sys.argv[1])
|
||||
|
||||
state = {
|
||||
"colors": [f"color_{i}" for i in range(1, n + 1)],
|
||||
"numbers": [f"number_{i}" for i in range(1, n + 1)],
|
||||
"animals": [f"animal_{i}" for i in range(1, n + 1)],
|
||||
}
|
||||
|
||||
print(json.dumps(state))
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue