zip/
lib.rs

1//! A library for reading and writing ZIP archives.
2//! ZIP is a format designed for cross-platform file "archiving".
3//! That is, storing a collection of files in a single datastream
4//! to make them easier to share between computers.
5//! Additionally, ZIP is able to compress and encrypt files in its
6//! archives.
7//!
8//! The current implementation is based on [PKWARE's APPNOTE.TXT v6.3.9](https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT)
9//!
10//! ---
11//!
12//! [`zip`](`crate`) has support for the most common ZIP archives found in common use.
13//! However, in special cases,
14//! there are some zip archives that are difficult to read or write.
15//!
16//! This is a list of supported features:
17//!
18//! |         | Reading | Writing |
19//! | ------- | ------  | ------- |
20//! | Stored | ✅ | ✅ |
21//! | Deflate | ✅ [->](`crate::ZipArchive::by_name`)      | ✅ [->](`crate::write::FileOptions::compression_method`) |
22//! | Deflate64 | ✅ | |
23//! | Bzip2 | ✅ | ✅ |
24//! | ZStandard | ✅ | ✅ |
25//! | LZMA | ✅ | |
26//! | XZ | ✅ | |
27//! | AES encryption | ✅ | ✅ |
28//! | ZipCrypto deprecated encryption | ✅ | ✅ |
29//!
30//!
31#![cfg_attr(docsrs, feature(doc_auto_cfg))]
32#![warn(missing_docs)]
33#![allow(unexpected_cfgs)] // Needed for cfg(fuzzing) on nightly as of 2024-05-06
34pub use crate::compression::{CompressionMethod, SUPPORTED_COMPRESSION_METHODS};
35pub use crate::read::HasZipMetadata;
36pub use crate::read::ZipArchive;
37pub use crate::spec::{ZIP64_BYTES_THR, ZIP64_ENTRY_THR};
38pub use crate::types::{AesMode, DateTime};
39pub use crate::write::ZipWriter;
40
41#[cfg(feature = "aes-crypto")]
42mod aes;
43#[cfg(feature = "aes-crypto")]
44mod aes_ctr;
45mod compression;
46mod cp437;
47mod crc32;
48pub mod extra_fields;
49mod path;
50pub mod read;
51pub mod result;
52mod spec;
53mod types;
54pub mod write;
55mod zipcrypto;
56pub use extra_fields::ExtraField;
57
58#[doc = "Unstable APIs\n\
59\
60All APIs accessible by importing this module are unstable; They may be changed in patch \
61releases. You MUST use an exact version specifier in `Cargo.toml`, to indicate the version of this \
62API you're using:\n\
63\
64```toml\n
65[dependencies]\n
66zip = \"="]
67#[doc=env!("CARGO_PKG_VERSION")]
68#[doc = "\"\n\
69```"]
70pub mod unstable;