Hacker News
Show HN: ZAR – A new archive format with history, deduplication, encryption
Wicher
|next
[-]
For any new format I'd like to have that flexibility at least in the format; the utilities can implement it later or not at all but at least the format should allow for the required alignment.
luckystarr
|next
|previous
[-]
lifthrasiir
|next
|previous
[-]
(I have much more ambitious and possibly competiting format called Aqueous [2], as you may have seen in r/rust, but these points are genuine advices for you ;-)
[1] https://github.com/brmmm3/zar-rs/blob/master/doc/zar-file-fo...
bonki
|next
|previous
[-]
Example use case: Store multiple versions of a game (which means they don't really share a chronological history, but possibly share assets which can be deduplicated)? This would avoid having to deal with subfolders inside the archive and push the abstraction from the file layout to the archive format. Being able to store unrelated archives inside the same file would be great.
Also, can commits be named?
brmmm3
|root
|parent
[-]
bonki
|root
|parent
[-]
# zarc create games.zar
# zarc add games.zar ./doom1-v0.1/ --slot doom1 --commit-name v0.1
# zarc add games.zar ./doom1-v0.2/ --slot doom1 --commit-name v0.2
# zarc add games zar ./quake1-v1.01/ --slot quake1 --commit-name v1.01
# zarc extract games.zar --output ./doom1-v0.1 --slot doom1 --commit-name v0.1
or # zarc create backup.zar
# zarc add backup.zar /etc ~/.config --slot config
# zarc add backup.zar ~/.maildir --slot mail
# zarc extract backup.zar --output ~/ --slot mail --commit latest
brmmm3
|root
|parent
|next
[-]
bonki
|root
|parent
[-]
a) bundle related file structures together which share no history (e.g. oranges + grapefruits) b) bundle unrelated file structures together which are related to a 3rd party (e.g. alice's oranges + bob's oranges)
Usually you would just throw everything in subfolders inside the archive but this has a lot of drawbacks (both ergonomical as well as technical) and I can think of all sorts of use cases where this would be very handy.
brmmm3
|root
|parent
|previous
[-]
Your idea is a complete different use case, but interesting and not too complicated to implement. Next version will support:
- Select first and last commit
- Select commits by commit name, where name ca be an fnmatch filter. So you can select for example all commits which are related to mail with "mail*"
bonki
|root
|parent
[-]
xurbax
|next
|previous
[-]
The only thing with similar features that I know of is ZPAQ. https://mattmahoney.net/dc/zpaq.html
koziserek
|next
|previous
[-]
can you avoid zstd?
exiting 'pure rust' breaks the deal for me when considering to include in my project.
lifthrasiir
|root
|parent
[-]
brmmm3
|root
|parent
|next
[-]
Unfortunately the performance is much worse than with zstd.
Tested with compiled linux kernel 6.1.1:
- zstd: compress ~6s, uncompress ~6s
- mzstd: compress ~7s, uncompress ~8s (encrypted 33s)
brmmm3
|root
|parent
|previous
[-]
bad_username
|next
|previous
[-]
peter_d_sherman
|next
|previous
[-]
arkg03
|next
|previous
[-]
brmmm3
|root
|parent
[-]
As you already know zip, 7z, tar this project provides a new archive format including tools for users and a library for developers.
The reason why I'm developing it is that I'm not satisfied with the exsting archivers. They all are very slow and not using the full power of today's CPUs and SSDs. zar does. It is very fast. My measurements have shown up 22 times faster than 7z with LZMA2. But this depends much on the OS, data and hardware.
And it comes with much more features which other archives don't provide and you may like:
- Versioning: With zar you can add/remove/replace (same) files to/in existing zar archives. This gives you the possibility to have several versions of a file in the archive. Example: You have an Excel file which you change from time to time. You can have all versions in that one zar file. Every action done on the zar archive is called a commit, as you may already know from git.
- Encryption: You can encrypt each commit individually. This gives you the possibility to have data with different protection levels in one file. For example you have a team of developers and want to provide specific project information/data to specific people. You can distribute this single file to all team members and everyone sees only what he is allowed to see.
- Streaming: zar supports streaming. For example you can stream only parts of a zar file to other machines. So the clients don't need to download and temporary extract the whole zar file.
- Mounting: You can mount a zar file, like an iso file, and access the contents with a file explorer.
- grep: zar has an integrated grep feature. So you can search for contents in a zar archive without extracting it.
- AI support: zar also comes with an MCP which gives the AI direct access to zar files.
childintime
|root
|parent
[-]
Come to think of it, if you include a link to a UI, that opens as a webpage, downloaded, and serve the contents of the zar to it, it may actually be a nice hybrid format. Haven't thought it through though.