rar-stream 5.3.1 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +35 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -125,6 +125,41 @@ interface FileMedia {
125
125
  | `streamToBuffer(stream)` | Convert Readable to Buffer |
126
126
  | `createFileMedia(source)` | Wrap any `{ createReadStream }` as FileMedia |
127
127
 
128
+ ### Rust API
129
+
130
+ #### In-Memory (no features required)
131
+
132
+ ```rust
133
+ use rar_stream::{MemoryArchive, is_rar_archive, detect_version};
134
+
135
+ // Check format
136
+ let data = std::fs::read("archive.rar")?;
137
+ assert!(is_rar_archive(&data));
138
+
139
+ // Parse and extract
140
+ let archive = MemoryArchive::new(&data)?;
141
+ let info = archive.archive_info();
142
+ println!("Format: {:?}, solid: {}", info.version, info.is_solid);
143
+
144
+ for entry in archive.entries() {
145
+ println!("{}: {} bytes", entry.name, entry.unpacked_size);
146
+ }
147
+ let content = archive.extract(0)?;
148
+ let readme = archive.extract_by_name("README.md")?;
149
+ ```
150
+
151
+ #### Async (requires `async` feature)
152
+
153
+ ```rust
154
+ use rar_stream::{RarFilesPackage, ParseOptions, LocalFileMedia, FileMedia};
155
+ use std::sync::Arc;
156
+
157
+ let file: Arc<dyn FileMedia> = Arc::new(LocalFileMedia::new("archive.rar")?);
158
+ let package = RarFilesPackage::new(vec![file]);
159
+ let files = package.parse(ParseOptions::default()).await?;
160
+ let content = files[0].read_to_end().await?;
161
+ ```
162
+
128
163
  ## Feature Flags
129
164
 
130
165
  ### Rust (Cargo)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rar-stream",
3
- "version": "5.3.1",
3
+ "version": "5.4.0",
4
4
  "description": "RAR streaming library - Rust implementation with NAPI and WASM bindings",
5
5
  "main": "lib/index.mjs",
6
6
  "browser": "lib/browser.mjs",