All Projects → rust-compress → rc-zip

rust-compress / rc-zip

Licence: MIT License
Pure rust zip & zip64 reading and writing

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to rc-zip

Zipstorer
A Pure C# Class to Store Files in Zip
Stars: ✭ 139 (+49.46%)
Mutual labels:  compression, zip
Turbobench
Compression Benchmark
Stars: ✭ 211 (+126.88%)
Mutual labels:  compression, zip
Bit7z
A C++ static library offering a clean and simple interface to the 7-zip DLLs.
Stars: ✭ 159 (+70.97%)
Mutual labels:  compression, zip
ratarmount
Random Access Read-Only Tar Mount
Stars: ✭ 217 (+133.33%)
Mutual labels:  compression, zip
unzip
Tiny unzip helper class for .NET 3.5 Client Profile and Mono 2.10, written in pure C#.
Stars: ✭ 25 (-73.12%)
Mutual labels:  compression, zip
Zippy
Pure Nim implementation of deflate, zlib, gzip and zip.
Stars: ✭ 88 (-5.38%)
Mutual labels:  compression, zip
Datacompression
Swift libcompression wrapper as an extension for the Data type (GZIP, ZLIB, LZFSE, LZMA, LZ4, deflate, RFC-1950, RFC-1951, RFC-1952)
Stars: ✭ 191 (+105.38%)
Mutual labels:  compression, zip
Minizip Ng
Fork of the popular zip manipulation library found in the zlib distribution.
Stars: ✭ 750 (+706.45%)
Mutual labels:  compression, zip
VszLib
7-zip VB6 Helper
Stars: ✭ 35 (-62.37%)
Mutual labels:  compression, zip
qlZipInfo
MacOSX QuickLook Generator for zip, jar, tar, tar.gz (.tgz), tar.bz2 (.tbz2/.tbz), tar.Z. xar (.xar, .pkg), debian (.deb), RedHat Package Manager (.rpm), 7zip (.7z), xz, Microsoft cabinet (.cab), gzip (.gz), lha, BinHex 4.0 (.hqx), and Stuffit (.sit) archives, and ISO9660 images
Stars: ✭ 47 (-49.46%)
Mutual labels:  compression, zip
Zip
Efficient library for manipulating zip archives
Stars: ✭ 69 (-25.81%)
Mutual labels:  compression, zip
box
Box - Open Standard Archive Format, a zip killer.
Stars: ✭ 38 (-59.14%)
Mutual labels:  compression, zip
Zipper
🗳A library to create, read and modify ZIP archive files, written in Swift.
Stars: ✭ 38 (-59.14%)
Mutual labels:  compression, zip
Sharpcompress
SharpCompress is a fully managed C# library to deal with many compression types and formats.
Stars: ✭ 1,397 (+1402.15%)
Mutual labels:  compression, zip
Peazip
Free Zip / Unzip software and Rar file extractor. Cross-platform file and archive manager. Features volume spanning, compression, authenticated encryption. Supports 7Z, 7-Zip sfx, ACE, ARJ, Brotli, BZ2, CAB, CHM, CPIO, DEB, GZ, ISO, JAR, LHA/LZH, NSIS, OOo, PAQ/LPAQ, PEA, QUAD, RAR, RPM, split, TAR, Z, ZIP, ZIPX, Zstandard.
Stars: ✭ 827 (+789.25%)
Mutual labels:  compression, zip
Zip
Swift framework for zipping and unzipping files.
Stars: ✭ 2,120 (+2179.57%)
Mutual labels:  compression, zip
Zip
A portable, simple zip library written in C
Stars: ✭ 596 (+540.86%)
Mutual labels:  compression, zip
Leanify
lightweight lossless file minifier/optimizer
Stars: ✭ 694 (+646.24%)
Mutual labels:  compression, zip
ZipArchive
A single-class pure VB6 library for zip with ASM speed
Stars: ✭ 38 (-59.14%)
Mutual labels:  compression, zip
Perfect-Zip
Perfect Zip compression utility.
Stars: ✭ 20 (-78.49%)
Mutual labels:  compression, zip

rc-zip

Build Status MIT licensed

Motivation

Have a pure rust, highly compatible, I/O-model independent, zip reading and writing library.

Design decisions

This crate does not perform I/O directly. Instead, it uses a state machine, and asks for reads at specific offsets. This allows it to work under different I/O models: blocking, non-blocking, and async. It has no expectations of the zip archive being present on disk (ie. it doesn't assume std::fs), just that random access is possible.

This crate relies fully on the central directory, not on local headers:

[local file header 1] // <---------------- ignored
[file data 1]
[local file header 2]
[file data 2]
[central directory header 1] // <--------- used
[central directory header 2]
[end of central directory record]

The reason for that is that the central directory is the canonical list of entries in a zip. Archives that have been repacked may contain duplicate local file headers (and data), along with headers for entries that have been removed. Only the central directory is authoritative when it comes to the contents of a zip archive.

This crate accepts what is known as "trailing zips" - for example, files that are valid ELF or PE executables, and merely have a valid zip archive appended. This covers some forms of self-extracting archives and installers.

This crate recognizes and uses zip64 metadata. This allows for a large number of entries (above 65536) and large entries (above 4GiB). This crate attempts to forgives some non-standard behavior from common tools. Such behavior has been observed in the wild and is, whenever possible, tested.

This crate attempts to recognize as much metadata as possible, and normalize it. For example, MSDOS timestamps, NTFS timestamps, Extended timestamps and Unix timestamps are supported, and they're all converted to a chrono DateTime.

Although the normalized version of metadata (names, timestamps, UID, GID, etc.) is put front and center, this crate attempts to expose a "raw" version of that same metadata whenever the authors felt it was necessary.

Whenever the zip archive doesn't explicitly specify UTF-8 encoding, this crate relies on encoding detection to decide between CP-437 and Shift-JIS. It uses encoding_rs to deal with Shift-JIS.

Due to the history of the zip format, some compatibility issues are to be expected: for example, for archives with only MSDOS timestamps, the results might be in the wrong timezone. For archive with very few files and non-UTF8 names, the encoding might not be detected properly, and thus decoding may fail.

As much as possible, nom is used to parse the various data structures used in the zip archive format. This allows a semi-declarative style that is easier to write, read, and amend if needed. Some (hygienic) macros are used to avoid repetition.

API design

The design of the API is constrained by several parameters:

  • A compliant zip reader must first read the central directory, located near the end of the zip archive. This means simply taking an Read won't do.
  • Multiple I/O models must be supported. Whereas other crates focus on taking a Read, a Read + Seek, or simply a byte slice, this crate aims to support synchronous and asynchronous I/O.

As a result, the structs in this crate are state machines, that advertise their need to read (and from where), to process data, or to write. As a result, I/O errors are cleanly separated from the rest, and calls to this crate never block.

See the inline rustdoc comments for more details on API design.

License

rc-zip is released under the MIT License. See the LICENSE file for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].