1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
//! A library for reading and writing PNA archives.
//!
//! This library provides utilities necessary to manage PNA archives
//! abstracted over a reader or writer. Great strides are taken to ensure that
//! an archive is never required to be fully resident in memory, and all objects
//! provide largely a streaming interface to read bytes from.
//!
//! # Quick Start
//!
//! ## Creating an Archive
//!
//! ```no_run
//! use libpna::{Archive, EntryBuilder, WriteOptions};
//! use std::fs::File;
//! use std::io::{self, Write};
//!
//! fn main() -> io::Result<()> {
//! let file = File::create("archive.pna")?;
//! let mut archive = Archive::write_header(file)?;
//!
//! // Add a file entry
//! let mut entry = EntryBuilder::new_file(
//! "hello.txt".into(),
//! WriteOptions::builder().build(),
//! )?;
//! entry.write_all(b"Hello, world!")?;
//! archive.add_entry(entry.build()?)?;
//!
//! // Add a directory entry
//! let dir = EntryBuilder::new_dir("my_folder/".into());
//! archive.add_entry(dir.build()?)?;
//!
//! archive.finalize()?;
//! Ok(())
//! }
//! ```
//!
//! ## Reading an Archive
//!
//! ```no_run
//! use libpna::{Archive, ReadEntry, ReadOptions};
//! use std::fs::File;
//! use std::io::{self, Read};
//!
//! fn main() -> io::Result<()> {
//! let file = File::open("archive.pna")?;
//! let mut archive = Archive::read_header(file)?;
//!
//! for entry in archive.entries().skip_solid() {
//! let entry = entry?;
//! println!("Entry: {}", entry.header().path().as_path().display());
//!
//! // Read file contents
//! let mut reader = entry.reader(ReadOptions::builder().build())?;
//! let mut contents = Vec::new();
//! reader.read_to_end(&mut contents)?;
//! }
//! Ok(())
//! }
//! ```
//!
//! # Compression and Encryption
//!
//! PNA supports multiple compression algorithms and encryption options:
//!
//! ```no_run
//! use libpna::{WriteOptions, Compression, Encryption, CipherMode, HashAlgorithm};
//!
//! // Compressed entry (Zstandard)
//! let compressed = WriteOptions::builder()
//! .compression(Compression::ZStandard)
//! .build();
//!
//! // Encrypted entry (AES-256-CTR with Argon2id key derivation)
//! let encrypted = WriteOptions::builder()
//! .compression(Compression::ZStandard)
//! .encryption(Encryption::Aes)
//! .cipher_mode(CipherMode::CTR)
//! .hash_algorithm(HashAlgorithm::argon2id())
//! .password(Some("secure_password"))
//! .build();
//! ```
//!
//! # Solid Mode
//!
//! Solid mode compresses multiple files together for better compression ratios:
//!
//! ```no_run
//! use libpna::{Archive, EntryBuilder, SolidEntryBuilder, WriteOptions};
//! use std::io::{self, Write};
//!
//! fn main() -> io::Result<()> {
//! let mut archive = Archive::write_header(Vec::new())?;
//!
//! // Create a solid entry containing multiple files
//! let mut solid = SolidEntryBuilder::new(WriteOptions::builder().build())?;
//!
//! let mut file1 = EntryBuilder::new_file("file1.txt".into(), WriteOptions::store())?;
//! file1.write_all(b"Content 1")?;
//! solid.add_entry(file1.build()?)?;
//!
//! let mut file2 = EntryBuilder::new_file("file2.txt".into(), WriteOptions::store())?;
//! file2.write_all(b"Content 2")?;
//! solid.add_entry(file2.build()?)?;
//!
//! archive.add_entry(solid.build()?)?;
//! archive.finalize()?;
//! Ok(())
//! }
//! ```
//!
//! # Key Types
//!
//! - [`Archive`] - Main entry point for reading and writing archives
//! - [`EntryBuilder`] - Builder for creating file, directory, and link entries
//! - [`SolidEntryBuilder`] - Builder for creating solid (multi-file) entries
//! - [`WriteOptions`] - Configuration for compression and encryption when writing
//! - [`ReadOptions`] - Configuration (password) for reading encrypted entries
//! - [`NormalEntry`] / [`SolidEntry`] / [`ReadEntry`] - Entry types for reading
//! - [`Chunk`] / [`ChunkType`] - Low-level chunk primitives
//!
//! # Feature Flags
//!
//! - `zlib-ng` - Use zlib-ng for improved deflate compression performance
//! - `unstable-async` - Enable async I/O support via `futures-io` (unstable API)
pub
pub
pub
pub
pub
pub
pub
pub
pub
pub
pub use *;
pub use *;
pub use *;
pub use UnknownValueError;
pub use Duration;