• 欢迎访问速搜资源吧,如果在网站上找不到你需要的资源,可以在留言板上留言,管理员会尽量满足你!

【速搜问答】Gzip是什么

问答 admin 3个月前 (09-02) 49次浏览 已收录 0个评论

汉英对照:
Chinese-English Translation:

Gzip是一种压缩文件格式并且也是一个在类Unix 上的一种文件解压缩的软件,通常指GNU计划的实现,此处的gzip代表GNU zip。也经常用来表示gzip这种文件格式。 Gzip 是一种压缩文件格式并且也是一个在类 Unix 上的一种文件解压缩的软件,通常指 GNU 计划的实现,此处的 gzip 代表 GNU zip。也经常用来表示 gzip 这种文件格式。软件的作者是 Jean-loup Gailly 和 Mark Adler。

Gzip is a compressed file format and also a file decompression software on UNIX like. It usually refers to the implementation of GNU plan, where gzip represents GNU zip. It is also often used to represent the file format gzip. Gzip is a compressed file format and also a file decompression software on UNIX like. It usually refers to the implementation of GNU plan, where gzip represents GNU zip. It is also often used to represent the file format gzip. The authors of the software are Jean Loup Gailly and mark Adler.

在 1992 年 10 月 31 日第一次公开发布,版本号 0.1,1993 年 2 月,发布了 1.0 版本。OpenBSD 中所包含的 gzip 版本实际上是 compress 程序,其对 gzip 文件的支持在 OpenBSD 3.4 中被添加,此处的 g 代表免费(gratis)。

It was first released to the public on October 31, 1992, version 0.1, and in February 1993, version 1.0 was released. The gzip version included in OpenBSD is actually a compress program. Its support for gzip files is added in OpenBSD 3.4, where g stands for gratis.

文件格式

file format

gzip 的基础是 DEFLATE,DEFLATE 是 LZ77 与哈夫曼编码的一个组合体。DEFLATE 最初是作为 LZW 以及其它受专利保护的数据压缩算法的替代版本而设计的,当时那些专利限制了 compress 以及其它一些流行的归档工具的应用。

The basis of gzip is deflate, which is a combination of LZ77 and Huffman coding. Deflate was originally designed as an alternative to LZW and other patented data compression algorithms that limited the use of compress and other popular archiving tools.

文件格式说明:

File format description:

10 字节的头,包含幻数、版本号以及时间戳

A 10 byte header containing the magic number, version number, and timestamp

可选的扩展头,如原文件名

Optional extension header, such as the original file name

文件体,包括 DEFLATE 压缩的数据

File body, including data compressed by deflate

8 字节的尾注,包括 CRC-32 校验和以及未压缩的原始数据长度

An 8-byte endnote, including CRC-32 checksums and uncompressed raw data length

尽管这种文件格式允许多个这样的数据拼接在一起,在解压时也能认出它们是拼接在一起的数据,但通常 gzip 仅用来压缩单个文件。多个文件的压缩归档通常是首先将这些文件合并成一个 tar 文件,然后再使用 gzip 进行压缩,最后生成的.tar.gz 或者.tgz 文件就是所谓的“tar 压缩包”或者“tarball”。

Although this file format allows multiple such data to be spliced together and can be recognized as spliced data when decompressed, gzip is usually only used to compress a single file. The compressed archive of multiple files is usually first merged into a tar file, then compressed by gzip, and finally generated tar.gz Or. Tgz files are called “tar packs” or “tarballs.”.

注意不要将 gzip 和 ZIP 压缩格式混淆。ZIP 也使用 DEFLATE 算法,而且可移植性更好,不需要一个外部的归档工具就可以包容多个文件。但是,由于 ZIP 对每个文件进行单独压缩而没有利用文件间的冗余信息(即固实压缩),所以 ZIP 的压缩率会稍逊于 tar 压缩包。

Be careful not to confuse gzip with zip compression format. Zip also uses deflate algorithm, and has better portability. It can contain multiple files without an external archive tool. However, the compression ratio of zip is slightly lower than that of tar because it compresses each file separately and does not use redundant information between files (i.e. solid compression).

gzip 命令的常用选项

Common options of gzip command

-c,–stdout 将解压缩的内容输出到标准输出,原文件保持不变

-c. – stdout outputs the extracted contents to standard output, leaving the original file unchanged

-d,–decompress 解压缩

-d. – decompress

-f,–force 强制覆盖旧文件

-f. – force force force to override old files

-l,–list 列出压缩包内储存的原始文件的信息(如,解压后的名字、压缩率等)

-l. – list lists the information of the original files stored in the compressed package (such as the name after decompression, compression ratio, etc.)

-n,–no-name 压缩时不保存原始文件的文件名和时间戳,解压缩时不恢复原始文件的文件名和时间戳(此时,解出来的文件,其文件名为压缩包的文件名)

-n. – no name does not save the file name and time stamp of the original file when compressing, and does not recover the file name and time stamp of the original file when decompressing (at this time, the file name of the extracted file is the file name of the compressed package)

-N,–name 压缩时保存原始文件的文件名和时间戳,解压缩时恢复原始文件的文件名和时间戳

-N. – name saves the file name and time stamp of the original file when compressing, and restores the file name and time stamp of the original file when decompressing

-q,–quiet 抑制所有警告信息

-q. – quiet suppresses all warning messages

-r,–recursive 递归

-r. Recursive

-t,–test 测试压缩文件完整性

-t. – test tests the integrity of compressed files

-v,–verbose 冗余模式(即显示每一步的执行内容)

-v. – verbose redundancy mode (i.e. display the execution content of each step)

-1、-2、…、-9 压缩率依次增大,速度依次减慢,默认为-6

-1、-2、… The compression ratio of – 9 increases in turn, and the speed slows down in turn. The default value is – 6

派生品和其它应用

Derivatives and other applications

在大多数 Linux 发行版中,通过使用 zx 选项来提取.tar.gz 格式的压缩文件,例如:tar -zxf file.tar.gz

In most Linux distributions, the ZX option is used to extract tar.gz Format, for example: tar – zxf file.tar.gz

zlib 是 DEFLATE 算法的实现库,它的 API 同时支持 gzip 文件格式以及一个简化的数据流格式。zlib 数据流格式、DEFLATE 以及 gzip 文件格式均已被分别标准化为 RFC 1950、RFC 1951、RFC 1952。

Zlib is the implementation library of deflate algorithm. Its API supports both gzip file format and a simplified data stream format. Zlib data stream format, deflate and gzip file format have been standardized to RFC 1950, RFC 1951 and RFC 1952 respectively.

gzip 在 HTTP 压缩,一种在万维网中加速传输 HTML 和其他内容的技术。它是在 RFC 2016 中规定的三种标准 HTTP 压缩格式之一。这个 RFC(征求意见稿)页定义了一种叫做”DEFLATE”的 zlib 格式,它和 gzip 格式相同,除了 gzip 添加了 11 字节头部和尾部的负载。但是,现在还是建议使用 gzip 而不是 zlib,因为根据 RFC 1950, IE 还没有正确的实现该标准,还不能处理 zlib 格式。

Gzip is compressed in HTTP, a technology to accelerate the transmission of HTML and other content in the world wide web. It is one of the three standard HTTP compression formats specified in RFC 2016. This RFC page defines a zlib format called “deflate”, which is the same as gzip, except that gzip adds an 11 byte header and tail payload. However, it is still recommended to use gzip instead of zlib, because according to RFC 1950, ie has not implemented the standard correctly and cannot handle zlib format.

zlib DEFLATE 已经在 Portable Network Graphics(PNG)格式中使用。

Zlib deflate is already used in portable network graphics (PNG) format.

自 20 世纪 90 年代末期以来,一个基于数据块排序算法的文件压缩工具 bzip2 作为 gzip 的替代者逐渐得到流行,它可以生成相当小的压缩文件,尤其是对于源代码和其他结构化文本更是这样,但代价是最高达 4 倍的内存与处理器时间消耗。bzip2 压缩的 tar 包传统上叫作.tar.bz2 或.tbz。

Since the late 1990s, bzip2, a file compression tool based on block sorting algorithm, has gradually become popular as an alternative to gzip. It can generate quite small compressed files, especially for source code and other structured text, but at a cost of up to four times the memory and processor time consumption. Bzip2 compressed tar package is traditionally called tar.bz2 Or. TBZ.

AdvanceCOMP 和 7zip 内部也有一个 DEFLATE 实现,可以制作 gzip 兼容的压缩文件,与 gzip 相比有更高的压缩率,不过比较耗费处理器的处理时间。

Advancecomp and 7zip also have a deflate implementation, which can make gzip compatible compressed files. Compared with gzip, it has a higher compression rate, but it consumes processing time of the processor.

gzip 压缩文件对应的解压程序是 gunzip。

The corresponding decompression program of gzip compressed file is gunzip.


速搜资源网 , 版权所有丨如未注明 , 均为原创丨转载请注明原文链接:【速搜问答】Gzip是什么
喜欢 (0)
[361009623@qq.com]
分享 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址