{"by":"rorosen","descendants":46,"id":44284871,"kids":[44289058,44288747,44288831,44291621,44290762,44289063,44289299,44288604,44294976,44289259,44292780,44291724,44294794,44292273,44289762,44307377,44289274,44294133],"score":214,"text":"Hello,<p>I would like to share a Rust implementation of the Zstandard seekable format I&#x27;ve been working on.<p>Regular zstd compressed files consist of a single frame, meaning you have to start decompression at the beginning. The seekable format splits compressed data into a series of independent frames, each compressed individually, so that decompression of a section in the middle of an archive only requires zstd to decompress at most a frame&#x27;s worth of extra data, instead of the entire archive.<p>I started working with the seekable format because I wanted to resume downloads of big zstd compressed files that are decompressed and written to disk on the fly. At first I created and used bindings to the C functions that are available upstream[1], however, I stumbled over the first segfault rather quickly (it&#x27;s now fixed) and found out that the functions only allow basic things. After looking closer at the upstream implementation, I noticed that is uses functions of the core API that are now deprecated and it doesn&#x27;t allow access to low-level (de)compression contexts. To me it looks like a PoC&#x2F;demo implementation that isn&#x27;t maintained the same way as the zstd core API, probably that&#x27;s also the reason it&#x27;s in the contrib directory.<p>My use-case seemed to require a complete rewrite of the seekable format, so I decided to implement it from scratch in Rust using bindings to the advanced zstd compression API, available from zstd 1.4.0.<p>The result is a single dependency library crate[2], and a CLI crate[3] for the seekable format that feels similar to the regular zstd tool.<p>Any feedback is highly appreciated!<p>[1]: <a href=\"https:&#x2F;&#x2F;github.com&#x2F;facebook&#x2F;zstd&#x2F;tree&#x2F;dev&#x2F;contrib&#x2F;seekable_format\">https:&#x2F;&#x2F;github.com&#x2F;facebook&#x2F;zstd&#x2F;tree&#x2F;dev&#x2F;contrib&#x2F;seekable_f...</a>\n[2]: <a href=\"https:&#x2F;&#x2F;crates.io&#x2F;crates&#x2F;zeekstd\" rel=\"nofollow\">https:&#x2F;&#x2F;crates.io&#x2F;crates&#x2F;zeekstd</a>\n[3]: <a href=\"https:&#x2F;&#x2F;github.com&#x2F;rorosen&#x2F;zeekstd&#x2F;tree&#x2F;main&#x2F;cli\">https:&#x2F;&#x2F;github.com&#x2F;rorosen&#x2F;zeekstd&#x2F;tree&#x2F;main&#x2F;cli</a>","time":1750020558,"title":"Show HN: Zeekstd – Rust Implementation of the ZSTD Seekable Format","type":"story","url":"https://github.com/rorosen/zeekstd"}