lz4 快速压缩工具

发布时间: 更新时间: 总字数:611 阅读时间:2m 作者:IP:上海 网址

lz4 利用 CPU 多核,压缩/解压速度很快,压缩率比较低,lz4 解压缩的对象是文件而非目录

介绍

  • 优点
    • 压缩/解压速度非常快,大约是 gzip 的 10 倍

安装

  • centos
yum install -y lz4 lz4-devel
  • ubuntu
apt install -y lz4

help

lz4 --help ...

使用

命令

cp /etc/hosts hosts

# 对文件进行压缩
$ lz4 hosts
Compressed filename will be : hosts.lz4
Compressed 252 bytes into 235 bytes ==> 93.25%
$ ls
hosts  hosts.lz4
$ rm hosts.lz4

# 指定压缩率,1 快速压缩;9 高压缩。使用 -f 覆盖
$ lz4 -1 hosts
Compressed filename will be : hosts.lz4
Compressed 252 bytes into 235 bytes ==> 93.25%
$ rm hosts.lz4

$ lz4 -9 hosts
Compressed filename will be : hosts.lz4
Compressed 252 bytes into 229 bytes ==> 90.87%
$ rm hosts.lz4

# 压缩后将文件删除
$ lz4 --rm hosts
Compressed filename will be : hosts.lz4
hosts.lz4 already exists; do you wish to overwrite (y/N) ? y
Compressed 252 bytes into 235 bytes ==> 93.25%
$ ls
hosts.lz4

# 解压
$ lz4 -d hosts.lz4
Decoding file hosts
hosts.lz4            : decoded 252 bytes
$ ls
hosts  hosts.lz4

# 压缩删除源文件
$ lz4 -q -f --rm hosts
$ ls
hosts.lz4

# 多文件压缩
$ lz4 -m hosts hosts.txt
$ ls
hosts  hosts.lz4  hosts.txt  hosts.txt.lz4

lib 库

F&Q

error 44 unrecognized header file cannot be decoded

lz4编解码器不匹配导致

本文总阅读量 次 本站总访问量 次 本站总访客数