LZ4算法实现对文件目录的压缩

我使用LZ4算法实现了对文件目录的压缩,方法就是将每个文件都压缩成一个LZ4格式,然后记录文件名字和长度,再将这些文件拼成一个大文件,但是速度比较慢。因为产生了中间文件。(也可以先拼接成一个大文件,然后再使用LZ4压缩。后面试一下。)我去问LZ4研发团队,他们给出了在windows和Linux上面压缩目录的方法。

项目地址:

https://github.com/lz4/lz4

issue地址:

https://github.com/lz4/lz4/issues/627

下面是他们的回复:

If you wish to compress directories, the correct way is to archive the directory, typically using tar, then pass the archive to lz4, producing a .tar.lz4 file.

On Unix systems, this association is pretty straightforward :
tar -cf - target_directory | lz4 -c > archive.tar.lz4
or
tar -I lz4 -cf archive.tar.lz4 target_directory

On Windows, it can be more difficult, depending on exact development environment. tar may or may not be available.

If you are used to GUI, you can use 7-zip Zstandard edition by @mcmilk, which includes an lz4 codec. There's also a command line version, available at : https://github.com/mcmilk/7-Zip-zstd

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

AllenSun-1990

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值