rar-stream 5.2.2 → 5.3.1
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.
- package/README.md +59 -8
- package/browser.d.ts +7 -7
- package/index.d.ts +1 -1
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -1,14 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>rar-stream</h1>
|
|
3
|
+
</div>
|
|
4
|
+
|
|
5
|
+
<div align="center"><p>
|
|
6
|
+
<a href="https://crates.io/crates/rar-stream"><img alt="Crates.io" src="https://img.shields.io/crates/v/rar-stream?style=for-the-badge&logo=rust&color=C9CBFF&logoColor=D9E0EE&labelColor=302D41" /></a>
|
|
7
|
+
<a href="https://crates.io/crates/rar-stream"><img alt="Crates.io Downloads" src="https://img.shields.io/crates/d/rar-stream?style=for-the-badge&logo=rust&color=A6E3A1&logoColor=D9E0EE&labelColor=302D41" /></a>
|
|
8
|
+
<a href="https://docs.rs/rar-stream"><img alt="docs.rs" src="https://img.shields.io/docsrs/rar-stream?style=for-the-badge&logo=docs.rs&color=8bd5ca&logoColor=D9E0EE&labelColor=302D41" /></a>
|
|
9
|
+
<a href="https://www.npmjs.com/package/rar-stream"><img alt="npm" src="https://img.shields.io/npm/v/rar-stream?style=for-the-badge&logo=npm&color=F5A97F&logoColor=D9E0EE&labelColor=302D41" /></a>
|
|
10
|
+
<a href="https://www.npmjs.com/package/rar-stream"><img alt="npm Downloads" src="https://img.shields.io/npm/dm/rar-stream?style=for-the-badge&logo=npm&color=F5E0DC&logoColor=D9E0EE&labelColor=302D41" /></a>
|
|
11
|
+
<a href="https://github.com/doom-fish/rar-stream#license"><img alt="License" src="https://img.shields.io/crates/l/rar-stream?style=for-the-badge&logo=apache&color=ee999f&logoColor=D9E0EE&labelColor=302D41" /></a>
|
|
12
|
+
<a href="https://github.com/doom-fish/rar-stream/actions"><img alt="Build Status" src="https://img.shields.io/github/actions/workflow/status/doom-fish/rar-stream/ci.yml?branch=main&style=for-the-badge&logo=github&color=c69ff5&logoColor=D9E0EE&labelColor=302D41" /></a>
|
|
13
|
+
<a href="https://codecov.io/gh/doom-fish/rar-stream"><img alt="Coverage" src="https://img.shields.io/codecov/c/github/doom-fish/rar-stream?style=for-the-badge&logo=codecov&color=F0C6C6&logoColor=D9E0EE&labelColor=302D41" /></a>
|
|
14
|
+
</p></div>
|
|
2
15
|
|
|
3
16
|
> Fast RAR archive streaming for Rust, Node.js, and browsers. Zero dependencies core.
|
|
4
17
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
[
|
|
8
|
-
[
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
[
|
|
18
|
+
## 📑 Table of Contents
|
|
19
|
+
|
|
20
|
+
- [Installation](#installation)
|
|
21
|
+
- [Quick Start](#quick-start)
|
|
22
|
+
- [Examples](#examples)
|
|
23
|
+
- [API](#api)
|
|
24
|
+
- [Feature Flags](#feature-flags)
|
|
25
|
+
- [Format Support](#format-support)
|
|
26
|
+
- [Performance](#performance)
|
|
27
|
+
- [Migrating from v3.x](#migrating-from-v3x)
|
|
28
|
+
- [Architecture](ARCHITECTURE.md)
|
|
29
|
+
- [Contributing](CONTRIBUTING.md)
|
|
30
|
+
- [Security](SECURITY.md)
|
|
31
|
+
- [Changelog](CHANGELOG.md)
|
|
32
|
+
- [License](#license)
|
|
12
33
|
|
|
13
34
|
## Installation
|
|
14
35
|
|
|
@@ -18,6 +39,8 @@
|
|
|
18
39
|
npm install rar-stream
|
|
19
40
|
```
|
|
20
41
|
|
|
42
|
+
Native binaries are automatically downloaded from [GitHub Releases](https://github.com/doom-fish/rar-stream/releases) during install. Supported platforms: Linux (x64, arm64), macOS (x64, arm64), Windows (x64).
|
|
43
|
+
|
|
21
44
|
### Rust
|
|
22
45
|
|
|
23
46
|
```toml
|
|
@@ -102,6 +125,30 @@ interface FileMedia {
|
|
|
102
125
|
| `streamToBuffer(stream)` | Convert Readable to Buffer |
|
|
103
126
|
| `createFileMedia(source)` | Wrap any `{ createReadStream }` as FileMedia |
|
|
104
127
|
|
|
128
|
+
## Feature Flags
|
|
129
|
+
|
|
130
|
+
### Rust (Cargo)
|
|
131
|
+
|
|
132
|
+
| Feature | Default | Description |
|
|
133
|
+
|---------|---------|-------------|
|
|
134
|
+
| `async` | No | Async archive reading via tokio (`RarFilesPackage`, `InnerFile`) |
|
|
135
|
+
| `crypto` | No | AES encryption (RAR4: AES-128, RAR5: AES-256) |
|
|
136
|
+
| `parallel` | No | Multi-threaded RAR5 decompression (rayon) |
|
|
137
|
+
| `napi` | No | Node.js bindings (implies `async` + `parallel`) |
|
|
138
|
+
| `wasm` | No | Browser WASM bindings |
|
|
139
|
+
|
|
140
|
+
### Platform Support
|
|
141
|
+
|
|
142
|
+
| Capability | Rust | Node.js (NAPI) | Browser (WASM) |
|
|
143
|
+
|-----------|------|----------------|----------------|
|
|
144
|
+
| Parse RAR4/RAR5 | ✅ | ✅ | ✅ |
|
|
145
|
+
| Decompress | ✅ | ✅ | ✅ |
|
|
146
|
+
| Encryption | ✅ (`crypto`) | ✅ (always on) | ✅ (`crypto`) |
|
|
147
|
+
| Async I/O | ✅ (`async`) | ✅ | — |
|
|
148
|
+
| Parallel decompress | ✅ (`parallel`) | ✅ (always on) | — |
|
|
149
|
+
| Multi-volume | ✅ | ✅ | ✅ |
|
|
150
|
+
| Streaming reads | ✅ | ✅ | — |
|
|
151
|
+
|
|
105
152
|
## Format Support
|
|
106
153
|
|
|
107
154
|
| Feature | RAR4 | RAR5 |
|
|
@@ -190,6 +237,10 @@ Ratio < 1.0 = rar-stream is faster.
|
|
|
190
237
|
|
|
191
238
|
Drop-in replacement. Same API, native Rust implementation. Requires Node.js 18+.
|
|
192
239
|
|
|
240
|
+
## Contributing
|
|
241
|
+
|
|
242
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, conventions, and the PR process.
|
|
243
|
+
|
|
193
244
|
## License
|
|
194
245
|
|
|
195
246
|
MIT
|
package/browser.d.ts
CHANGED
|
@@ -16,14 +16,14 @@ export function isRarArchive(data: Uint8Array): boolean;
|
|
|
16
16
|
/** Get RAR version (15 for RAR4, 50 for RAR5, 0 if not RAR) */
|
|
17
17
|
export function getRarVersion(data: Uint8Array): number;
|
|
18
18
|
|
|
19
|
-
/** Parse RAR header information */
|
|
19
|
+
/** Parse RAR header information (returns first file's header) */
|
|
20
20
|
export function parseRarHeader(data: Uint8Array): {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
name: string;
|
|
22
|
+
packedSize: number;
|
|
23
|
+
unpackedSize: number;
|
|
24
|
+
method: number;
|
|
25
|
+
isCompressed: boolean;
|
|
26
|
+
dataOffset: number;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
/** RAR decompressor class */
|
package/index.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export interface RarFileInfo {
|
|
|
28
28
|
* The buffer should contain at least the first ~300 bytes of a .rar file.
|
|
29
29
|
*/
|
|
30
30
|
export declare function parseRarHeader(buffer: Buffer): RarFileInfo | null
|
|
31
|
-
/** Check if a buffer starts with a RAR signature. */
|
|
31
|
+
/** Check if a buffer starts with a RAR signature (RAR4 or RAR5). */
|
|
32
32
|
export declare function isRarArchive(buffer: Buffer): boolean
|
|
33
33
|
/** LocalFileMedia - reads from local filesystem. */
|
|
34
34
|
export declare class LocalFileMedia {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rar-stream",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.1",
|
|
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",
|
|
@@ -75,8 +75,7 @@
|
|
|
75
75
|
"bench:compare": "cargo bench -- --baseline main",
|
|
76
76
|
"profile": "cargo build --release && perf record -g ./target/release/examples/profile_decompress && perf report",
|
|
77
77
|
"flamegraph": "cargo flamegraph --bench decompress -- --bench",
|
|
78
|
-
"postinstall": "node scripts/postinstall.js"
|
|
79
|
-
"prepublishOnly": "napi prepublish -t npm --skip-gh-release"
|
|
78
|
+
"postinstall": "node scripts/postinstall.js"
|
|
80
79
|
},
|
|
81
80
|
"devDependencies": {
|
|
82
81
|
"@eslint/js": "^9.0.0",
|