rar-stream 5.4.0 → 5.6.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.
- package/browser.d.ts +84 -2
- package/index.d.ts +5 -0
- package/lib/index.mjs +1 -1
- package/package.json +1 -1
package/browser.d.ts
CHANGED
|
@@ -16,7 +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
|
-
/**
|
|
19
|
+
/** Extract the first file from a RAR archive buffer */
|
|
20
|
+
export function extractFile(archive: Uint8Array): {
|
|
21
|
+
name: string;
|
|
22
|
+
data: Uint8Array;
|
|
23
|
+
length: number;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** Parse RAR4 header information (returns first file's header) */
|
|
20
27
|
export function parseRarHeader(data: Uint8Array): {
|
|
21
28
|
name: string;
|
|
22
29
|
packedSize: number;
|
|
@@ -26,7 +33,57 @@ export function parseRarHeader(data: Uint8Array): {
|
|
|
26
33
|
dataOffset: number;
|
|
27
34
|
};
|
|
28
35
|
|
|
29
|
-
/**
|
|
36
|
+
/** Parse RAR5 header information (returns first file's header) */
|
|
37
|
+
export function parseRar5Header(data: Uint8Array): {
|
|
38
|
+
name: string;
|
|
39
|
+
packedSize: number;
|
|
40
|
+
unpackedSize: number;
|
|
41
|
+
method: number;
|
|
42
|
+
dictSizeLog: number;
|
|
43
|
+
isCompressed: boolean;
|
|
44
|
+
isDirectory: boolean;
|
|
45
|
+
dataOffset: number;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** Parse all RAR4 file headers from a buffer */
|
|
49
|
+
export function parseRarHeaders(data: Uint8Array): Array<{
|
|
50
|
+
name: string;
|
|
51
|
+
packedSize: number;
|
|
52
|
+
unpackedSize: number;
|
|
53
|
+
method: number;
|
|
54
|
+
isCompressed: boolean;
|
|
55
|
+
dataOffset: number;
|
|
56
|
+
}>;
|
|
57
|
+
|
|
58
|
+
/** Parse all RAR5 file headers from a buffer */
|
|
59
|
+
export function parseRar5Headers(data: Uint8Array): Array<{
|
|
60
|
+
name: string;
|
|
61
|
+
packedSize: number;
|
|
62
|
+
unpackedSize: number;
|
|
63
|
+
method: number;
|
|
64
|
+
dictSizeLog: number;
|
|
65
|
+
isCompressed: boolean;
|
|
66
|
+
isDirectory: boolean;
|
|
67
|
+
dataOffset: number;
|
|
68
|
+
}>;
|
|
69
|
+
|
|
70
|
+
/** High-level RAR archive reader */
|
|
71
|
+
export class RarFilesPackage {
|
|
72
|
+
constructor(data: Uint8Array);
|
|
73
|
+
free(): void;
|
|
74
|
+
[Symbol.dispose](): void;
|
|
75
|
+
readonly length: number;
|
|
76
|
+
parse(): Array<{
|
|
77
|
+
name: string;
|
|
78
|
+
length: number;
|
|
79
|
+
packedSize: number;
|
|
80
|
+
isDirectory: boolean;
|
|
81
|
+
}>;
|
|
82
|
+
extract(index: number): { name: string; data: Uint8Array; length: number };
|
|
83
|
+
extractAll(): Array<{ name: string; data: Uint8Array; length: number }>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** RAR4 decompressor */
|
|
30
87
|
export class RarDecoder {
|
|
31
88
|
constructor(unpacked_size: bigint);
|
|
32
89
|
free(): void;
|
|
@@ -37,8 +94,33 @@ export class RarDecoder {
|
|
|
37
94
|
reset(): void;
|
|
38
95
|
}
|
|
39
96
|
|
|
97
|
+
/** RAR5 decompressor */
|
|
98
|
+
export class Rar5Decoder {
|
|
99
|
+
constructor(unpacked_size: bigint, dict_size_log: number, method: number, is_solid: boolean);
|
|
100
|
+
free(): void;
|
|
101
|
+
[Symbol.dispose](): void;
|
|
102
|
+
decompress(data: Uint8Array): Uint8Array;
|
|
103
|
+
reset(): void;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** RAR5 AES-256 crypto helper */
|
|
107
|
+
export class Rar5Crypto {
|
|
108
|
+
constructor(password: string, salt: Uint8Array, lg2_count: number);
|
|
109
|
+
free(): void;
|
|
110
|
+
[Symbol.dispose](): void;
|
|
111
|
+
decrypt(iv: Uint8Array, data: Uint8Array): Uint8Array;
|
|
112
|
+
verify_password(check_value: Uint8Array): boolean;
|
|
113
|
+
}
|
|
114
|
+
|
|
40
115
|
// Snake_case aliases for compatibility
|
|
41
116
|
export { isRarArchive as is_rar_archive };
|
|
42
117
|
export { getRarVersion as get_rar_version };
|
|
118
|
+
export { extractFile as extract_file };
|
|
43
119
|
export { parseRarHeader as parse_rar_header };
|
|
120
|
+
export { parseRar5Header as parse_rar5_header };
|
|
121
|
+
export { parseRarHeaders as parse_rar_headers };
|
|
122
|
+
export { parseRar5Headers as parse_rar5_headers };
|
|
44
123
|
export { RarDecoder as WasmRarDecoder };
|
|
124
|
+
export { Rar5Decoder as WasmRar5Decoder };
|
|
125
|
+
export { Rar5Crypto as WasmRar5Crypto };
|
|
126
|
+
export { RarFilesPackage as WasmRarArchive };
|
package/index.d.ts
CHANGED
|
@@ -11,6 +11,11 @@ export interface ReadIntervalJs {
|
|
|
11
11
|
/** Parse options for filtering results. */
|
|
12
12
|
export interface ParseOptionsJs {
|
|
13
13
|
maxFiles?: number
|
|
14
|
+
/**
|
|
15
|
+
* Prefetch buffer size for header parsing in bytes (default: 32768).
|
|
16
|
+
* Increase for archives with many files over slow connections.
|
|
17
|
+
*/
|
|
18
|
+
headerPrefetchSize?: number
|
|
14
19
|
}
|
|
15
20
|
/** Parsed file info from RAR header. */
|
|
16
21
|
export interface RarFileInfo {
|
package/lib/index.mjs
CHANGED
|
@@ -247,7 +247,7 @@ class JsInnerFile {
|
|
|
247
247
|
if (start !== 0 || end !== this.length - 1) {
|
|
248
248
|
throw new Error('Range reads not supported for compressed files. Use readToEnd() instead.');
|
|
249
249
|
}
|
|
250
|
-
//
|
|
250
|
+
// Streaming decompression not supported for custom FileMedia
|
|
251
251
|
throw new Error('Streaming compressed files not yet supported for custom FileMedia.');
|
|
252
252
|
}
|
|
253
253
|
|