cdgriffith / puremagic

Pure python implementation of identifying files based off their magic numbers
MIT License
161 stars 34 forks source link

New archivers support: Brotli, LZ4 and ZStd #19

Closed stokito closed 4 years ago

stokito commented 4 years ago

Recently was published few new compression algorithms and formats that are going to be quite popular: Brotli from Google: is supported by all browsers, was standardized and have it's RFC but it doesn't have magic signature. LZ4 which is ultra fast and lightweight. ZStandard from Facebook which is already widely supported by a lot of systems including Linux kernel. It's mime type is application/zstd and it's magic is \x28\xB5\x2F\xFD Could you add a support for them? If yes please also add their tar version (tzst, tlz4, tbr). The more programs supports them then the easier it will be to migrate to this compressors.

cdgriffith commented 4 years ago

Thanks for bringing up these new formats, if you happen to have any of them please post example files.

stokito commented 4 years ago

well, on linux you can easily install the programs and create the test files yourself:

$ sudo apt install brotli lz4 zstd
$ touch test.txt
$ brotli -k test.txt
$ lz4 -k test.txt
$ zstd -k test.txt

I uploaded results:

Magics:

Mime types:

cdgriffith commented 4 years ago

Added brotil magic number in 1.7 for format 3 from https://github.com/google/brotli/issues/298 lz4 and zst added in 1.6