LZMA Support Proposal #108
Replies: 3 comments 5 replies
-
Thanks for the kind words! I mainly made |
Beta Was this translation helpful? Give feedback.
-
Thank you for the thoughtful response. Yes, I agree that a decompress-only mode is appropriate and useful for LZMA (and, down the road, BZIP2). And, I think decompression on both of these is simpler algorithmically (a typical result). The goal here would be simply to enable support for decoding the many 7z, ZIP-LZMA, and tar.xz files out there. Encoders for all of these are still in active use. My feeling is that the world does not need another LZMA encoder beyond what we have (including LZIP). I'll share my LZMA implementation with you! It's pretty fast and I believe is accurate, it's a bit strange since it has a pseudo streaming/chunking wrapper around it but this should feed into your async approaches (at least in concept). |
Beta Was this translation helpful? Give feedback.
-
One last follow up, LZMA2, a wrapper around LZMA, is really the gold standard here, but is not super well documented outside of reference implementations. Fortunately I've got that figured out, including all of tricky conversions needed in JavaScript vs. other languages in terms of 32 bit integer handling, notably Math.imul(). |
Beta Was this translation helpful? Give feedback.
-
Hello, and thank you for fflate, which I have followed for several years now. Having watched the compression space for about 20 years, including all the ports of the original zlib and especially including JS implementations, I think fflate represents a correct and good 'end state' for the long lineage of this functionality. Well done and thank you.
I'd like to ask about LZMA. I ask because I think this decompression method stands right up there with DEFLATE as an important contribution for the world, and it also has its own set of very elegant properties from a CS/algorithm standpoint. Of course, we all know in terms of sheer use, standard DEFLATE (and DEFLATE64) are the most common and likely will be going forward, and that's OK.
LZMA as you know is an available compression method in ZIP (Compression method 14 since v6.3 around 2006). In my view, any serious ZIP processor should support it (WinZip and others did in fact make LZMA archives with 'best compression' specified).
But more importantly, LZMA is used in several important other contents: 7-zip (.7z), XZ (.tar.xz) (uses LZMA2, a wrapper around LZMA); standalone LZMA (not really applicable to everyday use), and a somewhat obscure format LZIP (*.lz, *.tar.lz) which is basically improved GZIP in terms of archive header but using LZMA (my personal favorite). https://www.nongnu.org/lzip/
I myself have two working implementations of LZMA in JavaScript and would be happy to collaborate. These are inelegant implementations, pieced together ports from various places, and the second one is taken primarily from the C code in info-zip (a good starting point). Both pass an extensive set of test files that I have.
The same discussion applies to BZIP2, which is useful both in context of ZIP (dating back earlier than LZMA to v4.3) and also *.tar.bz2.
I see you've just tackled ZSTD. Would you be willing to tackle LZMA next? I think an fflate-style flzma would be a meaningful contribution to the world.
Tom
Beta Was this translation helpful? Give feedback.
All reactions