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//! | PPMd | ✅ | ✅ |
28//! | AES encryption | ✅ | ✅ |
29//! | ZipCrypto deprecated encryption | ✅ | ✅ |
30//!
31//!
32#![cfg_attr(docsrs, feature(doc_auto_cfg))]
33#![warn(missing_docs)]
34#![allow(unexpected_cfgs)] // Needed for cfg(fuzzing) on nightly as of 2024-05-06
35pub use crate::compression::{CompressionMethod, SUPPORTED_COMPRESSION_METHODS};
36pub use crate::read::HasZipMetadata;
37pub use crate::read::{ZipArchive, ZipReadOptions};
38pub use crate::spec::{ZIP64_BYTES_THR, ZIP64_ENTRY_THR};
39pub use crate::types::{AesMode, DateTime};
40pub use crate::write::ZipWriter;
41
42#[cfg(feature = "aes-crypto")]
43mod aes;
44#[cfg(feature = "aes-crypto")]
45mod aes_ctr;
46mod compression;
47mod cp437;
48mod crc32;
49pub mod extra_fields;
50mod path;
51pub mod read;
52pub mod result;
53mod spec;
54mod types;
55pub mod write;
56mod zipcrypto;
57pub use extra_fields::ExtraField;
58#[cfg(feature = "legacy-zip")]
59mod legacy;
60
61#[doc = "Unstable APIs\n\
62\
63All APIs accessible by importing this module are unstable; They may be changed in patch \
64releases. You MUST use an exact version specifier in `Cargo.toml`, to indicate the version of this \
65API you're using:\n\
66\
67```toml\n
68[dependencies]\n
69zip = \"="]
70#[doc=env!("CARGO_PKG_VERSION")]
71#[doc = "\"\n\
72```"]
73pub mod unstable;