@rahul_dadhich15/archive-kit 0.0.0-stage → 0.1.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/CHANGELOG.md +48 -0
- package/LICENSE +21 -0
- package/README.md +385 -2
- package/dist/gzip/index.cjs +439 -0
- package/dist/gzip/index.cjs.map +1 -0
- package/dist/gzip/index.d.cts +174 -0
- package/dist/gzip/index.d.ts +174 -0
- package/dist/gzip/index.js +424 -0
- package/dist/gzip/index.js.map +1 -0
- package/dist/index.cjs +1320 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +120 -0
- package/dist/index.d.ts +120 -0
- package/dist/index.js +1260 -0
- package/dist/index.js.map +1 -0
- package/dist/types-CY4dTVyZ.d.cts +34 -0
- package/dist/types-CY4dTVyZ.d.ts +34 -0
- package/dist/zip-create/index.cjs +357 -0
- package/dist/zip-create/index.cjs.map +1 -0
- package/dist/zip-create/index.d.cts +120 -0
- package/dist/zip-create/index.d.ts +120 -0
- package/dist/zip-create/index.js +350 -0
- package/dist/zip-create/index.js.map +1 -0
- package/dist/zip-extract/index.cjs +701 -0
- package/dist/zip-extract/index.cjs.map +1 -0
- package/dist/zip-extract/index.d.cts +298 -0
- package/dist/zip-extract/index.d.ts +298 -0
- package/dist/zip-extract/index.js +685 -0
- package/dist/zip-extract/index.js.map +1 -0
- package/package.json +91 -4
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { B as BinaryInput } from '../types-CY4dTVyZ.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Options for GZIP compression.
|
|
5
|
+
*/
|
|
6
|
+
interface GzipCompressOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Compression level between 0 (no compression / STORE) and 9 (maximum compression).
|
|
9
|
+
* Default is 6.
|
|
10
|
+
*/
|
|
11
|
+
level?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Optional original filename to embed in the GZIP header.
|
|
14
|
+
*/
|
|
15
|
+
filename?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Optional modification date/time to embed in the GZIP header.
|
|
18
|
+
*/
|
|
19
|
+
mtime?: Date | number;
|
|
20
|
+
/**
|
|
21
|
+
* Optional AbortSignal to cancel the operation.
|
|
22
|
+
*/
|
|
23
|
+
signal?: AbortSignal;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Options for GZIP decompression.
|
|
27
|
+
*/
|
|
28
|
+
interface GzipDecompressOptions {
|
|
29
|
+
/**
|
|
30
|
+
* Optional AbortSignal to cancel the operation.
|
|
31
|
+
*/
|
|
32
|
+
signal?: AbortSignal;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Options for GZIP Blob compression.
|
|
36
|
+
*/
|
|
37
|
+
interface GzipCompressBlobOptions extends GzipCompressOptions {
|
|
38
|
+
/**
|
|
39
|
+
* MIME type of the resulting Blob.
|
|
40
|
+
* Default is "application/gzip".
|
|
41
|
+
*/
|
|
42
|
+
mimeType?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Options for GZIP Blob decompression.
|
|
46
|
+
*/
|
|
47
|
+
interface GzipDecompressBlobOptions extends GzipDecompressOptions {
|
|
48
|
+
/**
|
|
49
|
+
* MIME type of the resulting decompressed Blob.
|
|
50
|
+
* Default is "application/octet-stream".
|
|
51
|
+
*/
|
|
52
|
+
mimeType?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Metadata extracted from a GZIP header and trailer.
|
|
56
|
+
*/
|
|
57
|
+
interface GzipMetadata {
|
|
58
|
+
/**
|
|
59
|
+
* Original uncompressed input size (mod 2^32 from GZIP trailer ISIZE), if present.
|
|
60
|
+
*/
|
|
61
|
+
originalSize?: number;
|
|
62
|
+
/**
|
|
63
|
+
* Compressed size of the GZIP payload in bytes.
|
|
64
|
+
*/
|
|
65
|
+
compressedSize: number;
|
|
66
|
+
/**
|
|
67
|
+
* Compression ratio (compressedSize / originalSize).
|
|
68
|
+
*/
|
|
69
|
+
compressionRatio: number;
|
|
70
|
+
/**
|
|
71
|
+
* Percentage saved compared to original uncompressed size.
|
|
72
|
+
*/
|
|
73
|
+
compressionPercentageSaved: number;
|
|
74
|
+
/**
|
|
75
|
+
* Embedded original filename from FNAME header, if present.
|
|
76
|
+
*/
|
|
77
|
+
filename?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Embedded comment from FCOMMENT header, if present.
|
|
80
|
+
*/
|
|
81
|
+
comment?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Embedded modification timestamp from MTIME header, if present.
|
|
84
|
+
*/
|
|
85
|
+
mtime?: Date;
|
|
86
|
+
/**
|
|
87
|
+
* Operating system indicator byte from header.
|
|
88
|
+
*/
|
|
89
|
+
os?: number;
|
|
90
|
+
/**
|
|
91
|
+
* Inferred MIME type.
|
|
92
|
+
*/
|
|
93
|
+
mimeType?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Suggested output filename.
|
|
96
|
+
*/
|
|
97
|
+
outputFilename?: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Checks synchronously whether the given data has a valid GZIP header signature.
|
|
102
|
+
*/
|
|
103
|
+
declare function isGzipDataSync(data: Uint8Array | ArrayBuffer): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Checks asynchronously whether the given data (Uint8Array, ArrayBuffer, Blob, File) has a valid GZIP signature.
|
|
106
|
+
*/
|
|
107
|
+
declare function isGzipData(data: BinaryInput): Promise<boolean>;
|
|
108
|
+
/**
|
|
109
|
+
* Synchronously parses GZIP header and trailer metadata.
|
|
110
|
+
*/
|
|
111
|
+
declare function getGzipMetadataSync(data: Uint8Array | ArrayBuffer): GzipMetadata;
|
|
112
|
+
/**
|
|
113
|
+
* Asynchronously parses GZIP metadata from any supported BinaryInput.
|
|
114
|
+
*/
|
|
115
|
+
declare function getGzipMetadata(data: BinaryInput): Promise<GzipMetadata>;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Compresses binary data with GZIP asynchronously.
|
|
119
|
+
* Suitable for browser applications to prevent blocking the UI.
|
|
120
|
+
*
|
|
121
|
+
* @param data - Input data as Uint8Array, ArrayBuffer, Blob, or File.
|
|
122
|
+
* @param options - Compression options including level (0-9) and metadata.
|
|
123
|
+
* @returns Compressed Uint8Array.
|
|
124
|
+
*/
|
|
125
|
+
declare function gzipCompress(data: BinaryInput, options?: GzipCompressOptions): Promise<Uint8Array>;
|
|
126
|
+
/**
|
|
127
|
+
* Synchronous GZIP compression for small in-memory buffers.
|
|
128
|
+
*
|
|
129
|
+
* @warning Calling this on large buffers will block the JavaScript main thread.
|
|
130
|
+
*/
|
|
131
|
+
declare function gzipCompressSync(data: Uint8Array | ArrayBuffer | string, options?: GzipCompressOptions): Uint8Array;
|
|
132
|
+
/**
|
|
133
|
+
* Compresses a UTF-8 text string into GZIP bytes asynchronously.
|
|
134
|
+
*/
|
|
135
|
+
declare function gzipCompressText(text: string, options?: GzipCompressOptions): Promise<Uint8Array>;
|
|
136
|
+
/**
|
|
137
|
+
* Synchronous text GZIP compression for small strings.
|
|
138
|
+
*
|
|
139
|
+
* @warning Blocks main thread on large strings.
|
|
140
|
+
*/
|
|
141
|
+
declare function gzipCompressTextSync(text: string, options?: GzipCompressOptions): Uint8Array;
|
|
142
|
+
/**
|
|
143
|
+
* Compresses data and returns a browser-ready Blob.
|
|
144
|
+
*/
|
|
145
|
+
declare function gzipCompressBlob(data: BinaryInput, options?: GzipCompressBlobOptions): Promise<Blob>;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Decompresses GZIP binary data asynchronously.
|
|
149
|
+
*
|
|
150
|
+
* @param data - GZIP data as Uint8Array, ArrayBuffer, Blob, or File.
|
|
151
|
+
* @param options - Decompression options including cancellation signal.
|
|
152
|
+
* @returns Decompressed Uint8Array.
|
|
153
|
+
*/
|
|
154
|
+
declare function gzipDecompress(data: BinaryInput, options?: GzipDecompressOptions): Promise<Uint8Array>;
|
|
155
|
+
/**
|
|
156
|
+
* Synchronous GZIP decompression for small in-memory buffers.
|
|
157
|
+
*
|
|
158
|
+
* @warning Blocks main thread on large buffers.
|
|
159
|
+
*/
|
|
160
|
+
declare function gzipDecompressSync(data: Uint8Array | ArrayBuffer, _options?: GzipDecompressOptions): Uint8Array;
|
|
161
|
+
/**
|
|
162
|
+
* Decompresses GZIP data directly into a UTF-8 string asynchronously.
|
|
163
|
+
*/
|
|
164
|
+
declare function gzipDecompressText(data: BinaryInput, options?: GzipDecompressOptions): Promise<string>;
|
|
165
|
+
/**
|
|
166
|
+
* Synchronous GZIP decompression to string for small in-memory data.
|
|
167
|
+
*/
|
|
168
|
+
declare function gzipDecompressTextSync(data: Uint8Array | ArrayBuffer, options?: GzipDecompressOptions): string;
|
|
169
|
+
/**
|
|
170
|
+
* Decompresses GZIP data directly into a browser-ready Blob.
|
|
171
|
+
*/
|
|
172
|
+
declare function gzipDecompressBlob(data: BinaryInput, options?: GzipDecompressBlobOptions): Promise<Blob>;
|
|
173
|
+
|
|
174
|
+
export { type GzipCompressBlobOptions, type GzipCompressOptions, type GzipDecompressBlobOptions, type GzipDecompressOptions, type GzipMetadata, getGzipMetadata, getGzipMetadataSync, gzipCompress, gzipCompressBlob, gzipCompressSync, gzipCompressText, gzipCompressTextSync, gzipDecompress, gzipDecompressBlob, gzipDecompressSync, gzipDecompressText, gzipDecompressTextSync, isGzipData, isGzipDataSync };
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { B as BinaryInput } from '../types-CY4dTVyZ.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Options for GZIP compression.
|
|
5
|
+
*/
|
|
6
|
+
interface GzipCompressOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Compression level between 0 (no compression / STORE) and 9 (maximum compression).
|
|
9
|
+
* Default is 6.
|
|
10
|
+
*/
|
|
11
|
+
level?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Optional original filename to embed in the GZIP header.
|
|
14
|
+
*/
|
|
15
|
+
filename?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Optional modification date/time to embed in the GZIP header.
|
|
18
|
+
*/
|
|
19
|
+
mtime?: Date | number;
|
|
20
|
+
/**
|
|
21
|
+
* Optional AbortSignal to cancel the operation.
|
|
22
|
+
*/
|
|
23
|
+
signal?: AbortSignal;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Options for GZIP decompression.
|
|
27
|
+
*/
|
|
28
|
+
interface GzipDecompressOptions {
|
|
29
|
+
/**
|
|
30
|
+
* Optional AbortSignal to cancel the operation.
|
|
31
|
+
*/
|
|
32
|
+
signal?: AbortSignal;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Options for GZIP Blob compression.
|
|
36
|
+
*/
|
|
37
|
+
interface GzipCompressBlobOptions extends GzipCompressOptions {
|
|
38
|
+
/**
|
|
39
|
+
* MIME type of the resulting Blob.
|
|
40
|
+
* Default is "application/gzip".
|
|
41
|
+
*/
|
|
42
|
+
mimeType?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Options for GZIP Blob decompression.
|
|
46
|
+
*/
|
|
47
|
+
interface GzipDecompressBlobOptions extends GzipDecompressOptions {
|
|
48
|
+
/**
|
|
49
|
+
* MIME type of the resulting decompressed Blob.
|
|
50
|
+
* Default is "application/octet-stream".
|
|
51
|
+
*/
|
|
52
|
+
mimeType?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Metadata extracted from a GZIP header and trailer.
|
|
56
|
+
*/
|
|
57
|
+
interface GzipMetadata {
|
|
58
|
+
/**
|
|
59
|
+
* Original uncompressed input size (mod 2^32 from GZIP trailer ISIZE), if present.
|
|
60
|
+
*/
|
|
61
|
+
originalSize?: number;
|
|
62
|
+
/**
|
|
63
|
+
* Compressed size of the GZIP payload in bytes.
|
|
64
|
+
*/
|
|
65
|
+
compressedSize: number;
|
|
66
|
+
/**
|
|
67
|
+
* Compression ratio (compressedSize / originalSize).
|
|
68
|
+
*/
|
|
69
|
+
compressionRatio: number;
|
|
70
|
+
/**
|
|
71
|
+
* Percentage saved compared to original uncompressed size.
|
|
72
|
+
*/
|
|
73
|
+
compressionPercentageSaved: number;
|
|
74
|
+
/**
|
|
75
|
+
* Embedded original filename from FNAME header, if present.
|
|
76
|
+
*/
|
|
77
|
+
filename?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Embedded comment from FCOMMENT header, if present.
|
|
80
|
+
*/
|
|
81
|
+
comment?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Embedded modification timestamp from MTIME header, if present.
|
|
84
|
+
*/
|
|
85
|
+
mtime?: Date;
|
|
86
|
+
/**
|
|
87
|
+
* Operating system indicator byte from header.
|
|
88
|
+
*/
|
|
89
|
+
os?: number;
|
|
90
|
+
/**
|
|
91
|
+
* Inferred MIME type.
|
|
92
|
+
*/
|
|
93
|
+
mimeType?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Suggested output filename.
|
|
96
|
+
*/
|
|
97
|
+
outputFilename?: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Checks synchronously whether the given data has a valid GZIP header signature.
|
|
102
|
+
*/
|
|
103
|
+
declare function isGzipDataSync(data: Uint8Array | ArrayBuffer): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Checks asynchronously whether the given data (Uint8Array, ArrayBuffer, Blob, File) has a valid GZIP signature.
|
|
106
|
+
*/
|
|
107
|
+
declare function isGzipData(data: BinaryInput): Promise<boolean>;
|
|
108
|
+
/**
|
|
109
|
+
* Synchronously parses GZIP header and trailer metadata.
|
|
110
|
+
*/
|
|
111
|
+
declare function getGzipMetadataSync(data: Uint8Array | ArrayBuffer): GzipMetadata;
|
|
112
|
+
/**
|
|
113
|
+
* Asynchronously parses GZIP metadata from any supported BinaryInput.
|
|
114
|
+
*/
|
|
115
|
+
declare function getGzipMetadata(data: BinaryInput): Promise<GzipMetadata>;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Compresses binary data with GZIP asynchronously.
|
|
119
|
+
* Suitable for browser applications to prevent blocking the UI.
|
|
120
|
+
*
|
|
121
|
+
* @param data - Input data as Uint8Array, ArrayBuffer, Blob, or File.
|
|
122
|
+
* @param options - Compression options including level (0-9) and metadata.
|
|
123
|
+
* @returns Compressed Uint8Array.
|
|
124
|
+
*/
|
|
125
|
+
declare function gzipCompress(data: BinaryInput, options?: GzipCompressOptions): Promise<Uint8Array>;
|
|
126
|
+
/**
|
|
127
|
+
* Synchronous GZIP compression for small in-memory buffers.
|
|
128
|
+
*
|
|
129
|
+
* @warning Calling this on large buffers will block the JavaScript main thread.
|
|
130
|
+
*/
|
|
131
|
+
declare function gzipCompressSync(data: Uint8Array | ArrayBuffer | string, options?: GzipCompressOptions): Uint8Array;
|
|
132
|
+
/**
|
|
133
|
+
* Compresses a UTF-8 text string into GZIP bytes asynchronously.
|
|
134
|
+
*/
|
|
135
|
+
declare function gzipCompressText(text: string, options?: GzipCompressOptions): Promise<Uint8Array>;
|
|
136
|
+
/**
|
|
137
|
+
* Synchronous text GZIP compression for small strings.
|
|
138
|
+
*
|
|
139
|
+
* @warning Blocks main thread on large strings.
|
|
140
|
+
*/
|
|
141
|
+
declare function gzipCompressTextSync(text: string, options?: GzipCompressOptions): Uint8Array;
|
|
142
|
+
/**
|
|
143
|
+
* Compresses data and returns a browser-ready Blob.
|
|
144
|
+
*/
|
|
145
|
+
declare function gzipCompressBlob(data: BinaryInput, options?: GzipCompressBlobOptions): Promise<Blob>;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Decompresses GZIP binary data asynchronously.
|
|
149
|
+
*
|
|
150
|
+
* @param data - GZIP data as Uint8Array, ArrayBuffer, Blob, or File.
|
|
151
|
+
* @param options - Decompression options including cancellation signal.
|
|
152
|
+
* @returns Decompressed Uint8Array.
|
|
153
|
+
*/
|
|
154
|
+
declare function gzipDecompress(data: BinaryInput, options?: GzipDecompressOptions): Promise<Uint8Array>;
|
|
155
|
+
/**
|
|
156
|
+
* Synchronous GZIP decompression for small in-memory buffers.
|
|
157
|
+
*
|
|
158
|
+
* @warning Blocks main thread on large buffers.
|
|
159
|
+
*/
|
|
160
|
+
declare function gzipDecompressSync(data: Uint8Array | ArrayBuffer, _options?: GzipDecompressOptions): Uint8Array;
|
|
161
|
+
/**
|
|
162
|
+
* Decompresses GZIP data directly into a UTF-8 string asynchronously.
|
|
163
|
+
*/
|
|
164
|
+
declare function gzipDecompressText(data: BinaryInput, options?: GzipDecompressOptions): Promise<string>;
|
|
165
|
+
/**
|
|
166
|
+
* Synchronous GZIP decompression to string for small in-memory data.
|
|
167
|
+
*/
|
|
168
|
+
declare function gzipDecompressTextSync(data: Uint8Array | ArrayBuffer, options?: GzipDecompressOptions): string;
|
|
169
|
+
/**
|
|
170
|
+
* Decompresses GZIP data directly into a browser-ready Blob.
|
|
171
|
+
*/
|
|
172
|
+
declare function gzipDecompressBlob(data: BinaryInput, options?: GzipDecompressBlobOptions): Promise<Blob>;
|
|
173
|
+
|
|
174
|
+
export { type GzipCompressBlobOptions, type GzipCompressOptions, type GzipDecompressBlobOptions, type GzipDecompressOptions, type GzipMetadata, getGzipMetadata, getGzipMetadataSync, gzipCompress, gzipCompressBlob, gzipCompressSync, gzipCompressText, gzipCompressTextSync, gzipDecompress, gzipDecompressBlob, gzipDecompressSync, gzipDecompressText, gzipDecompressTextSync, isGzipData, isGzipDataSync };
|