@zip.js/zip.js 2.6.7 → 2.6.8
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/dist/zip-fs-full.js +2 -2
- package/dist/zip-fs-full.min.js +1 -1
- package/dist/zip-fs.js +2 -2
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-full.js +2 -2
- package/dist/zip-full.min.js +1 -1
- package/dist/zip-no-worker-deflate.min.js +1 -1
- package/dist/zip-no-worker-inflate.min.js +1 -1
- package/dist/zip-no-worker.min.js +1 -1
- package/dist/zip.js +2 -2
- package/dist/zip.min.js +1 -1
- package/index.d.ts +1229 -252
- package/lib/core/zip-reader.js +1 -1
- package/lib/core/zip-writer.js +1 -1
- package/package.json +4 -3
- package/tests/web-runner.js +1 -1
- package/tsconfig.json +6 -0
package/index.d.ts
CHANGED
|
@@ -1,350 +1,1327 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The global object.
|
|
3
|
+
*/
|
|
3
4
|
declare global {
|
|
4
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Represents the `FileSystemEntry` class.
|
|
7
|
+
*
|
|
8
|
+
* @see {@link https://wicg.github.io/entries-api/#api-entry|specification}
|
|
9
|
+
*/
|
|
5
10
|
interface FileSystemEntry { }
|
|
6
11
|
}
|
|
7
12
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Configures zip.js
|
|
15
|
+
*
|
|
16
|
+
* @param configuration The configuration.
|
|
17
|
+
*/
|
|
18
|
+
export function configure(configuration: Configuration): void
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Represents the configuration passed to `configure()`.
|
|
22
|
+
*/
|
|
23
|
+
interface Configuration extends WorkerConfiguration {
|
|
24
|
+
/**
|
|
25
|
+
* The maximum number of web workers used to compress/decompress data simultaneously.
|
|
26
|
+
*
|
|
27
|
+
* @defaultValue `navigator.hardwareConcurrency`
|
|
28
|
+
*/
|
|
29
|
+
maxWorkers?: number
|
|
30
|
+
/**
|
|
31
|
+
* The delay in milliseconds before idle web workers are automatically terminated. You can call `terminateWorkers()` to terminate idle workers.
|
|
32
|
+
*
|
|
33
|
+
* @defaultValue 5000
|
|
34
|
+
*/
|
|
35
|
+
terminateWorkerTimeout?: number
|
|
36
|
+
/**
|
|
37
|
+
* The URIs of the compression/decompression scripts run in web workers.
|
|
38
|
+
*
|
|
39
|
+
* It allows using alternative deflate implementations or specifying a URL to the worker script if the CSP of the page blocks scripts imported from a Blob URI.
|
|
40
|
+
* The properties `deflate` and `inflate` must specify arrays of URLs to import the deflate/inflate web workers, respectively.
|
|
41
|
+
* The first URL is relative to the base URI of the document. The other URLs are relative to the URL of the first script. Scripts in the array are executed in order.
|
|
42
|
+
* If you only use deflation or inflation, the unused `deflate`/`inflate` property can be omitted.
|
|
43
|
+
*
|
|
44
|
+
* Here is an example:
|
|
45
|
+
* ```
|
|
46
|
+
* configure({
|
|
47
|
+
* workerScripts: {
|
|
48
|
+
* deflate: ["library_path/custom-worker.js", "./custom-deflate.js"],
|
|
49
|
+
* inflate: ["library_path/custom-worker.js", "./custom-inflate.js"]
|
|
50
|
+
* }
|
|
51
|
+
* });
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* If the CSP of the page blocks scripts imported from a Blob URI you can use `z-worker.js` from https://github.com/gildas-lormeau/zip.js/tree/master/dist and specify the URL where it can be found.
|
|
55
|
+
*
|
|
56
|
+
* Here is an example:
|
|
57
|
+
* ```
|
|
58
|
+
* configure({
|
|
59
|
+
* workerScripts: {
|
|
60
|
+
* deflate: ["library_path/z-worker.js"],
|
|
61
|
+
* inflate: ["library_path/z-worker.js"]
|
|
62
|
+
* }
|
|
63
|
+
* });
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
13
66
|
workerScripts?: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
67
|
+
/**
|
|
68
|
+
* The URIs of the scripts implementing used for compression.
|
|
69
|
+
*/
|
|
70
|
+
deflate?: string[]
|
|
71
|
+
/**
|
|
72
|
+
* The URIs of the scripts implementing used for decompression.
|
|
73
|
+
*/
|
|
74
|
+
inflate?: string[]
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The size of the chunks in bytes during data compression/decopression.
|
|
78
|
+
*
|
|
79
|
+
* @defaultValue 524288
|
|
80
|
+
*/
|
|
81
|
+
chunkSize?: number
|
|
82
|
+
/**
|
|
83
|
+
* The implementation used to compress data when `useWebWorkers` is set to `false`.
|
|
84
|
+
*
|
|
85
|
+
* @defaultValue `ZipDeflate`
|
|
86
|
+
*/
|
|
87
|
+
Deflate?: typeof ZipDeflate
|
|
88
|
+
/**
|
|
89
|
+
* The implementation used to decompress data when `useWebWorkers` is set to `false`.
|
|
90
|
+
*
|
|
91
|
+
* @defaultValue `ZipInflate`
|
|
92
|
+
*/
|
|
93
|
+
Inflate?: typeof ZipInflate
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Represents configuration passed to `configure()`, the constructor of `ZipReader`, `ZipReader#getData()`, the constructor of `ZipWriter`, and `ZipWriter#add()`.
|
|
98
|
+
*/
|
|
99
|
+
interface WorkerConfiguration {
|
|
100
|
+
/**
|
|
101
|
+
* `true` to use web workers to compress/decompress data in non-blocking background processes.
|
|
102
|
+
*
|
|
103
|
+
* @defaultValue true
|
|
104
|
+
*/
|
|
105
|
+
useWebWorkers?: boolean
|
|
106
|
+
/**
|
|
107
|
+
* `true` to use the API `CompressionStream`/`DecompressionStream` to compress/decompress data.
|
|
108
|
+
*
|
|
109
|
+
* @defaultValue true
|
|
110
|
+
*/
|
|
111
|
+
useCompressionStream?: boolean
|
|
20
112
|
}
|
|
21
113
|
|
|
22
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Transforms event-based third-party codec implementations into implementations compatible with zip.js
|
|
116
|
+
*
|
|
117
|
+
* @param library The third-party codec implementations.
|
|
118
|
+
* @param constructorOptions The options passed to the third-party implementations when building instances.
|
|
119
|
+
* @returns An instance containing classes compatible with `ZipDeflate` and `ZipInflate`.
|
|
120
|
+
*/
|
|
121
|
+
export function initShimAsyncCodec(library: EventBasedZipLibrary, constructorOptions?: any): ZipLibrary
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Terminates all the idle web workers.
|
|
125
|
+
*/
|
|
126
|
+
export function terminateWorkers(): void
|
|
23
127
|
|
|
24
|
-
|
|
128
|
+
/**
|
|
129
|
+
* Represents event-based implementations used to compress/decompress data.
|
|
130
|
+
*/
|
|
131
|
+
interface EventBasedZipLibrary {
|
|
132
|
+
/**
|
|
133
|
+
* The class used to compress data.
|
|
134
|
+
*/
|
|
135
|
+
Deflate: typeof EventBasedCodec
|
|
136
|
+
/**
|
|
137
|
+
* The class used to decompress data.
|
|
138
|
+
*/
|
|
139
|
+
Inflate: typeof EventBasedCodec
|
|
140
|
+
}
|
|
25
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Represents an event-based implementation of a third-party codec.
|
|
144
|
+
*/
|
|
145
|
+
declare class EventBasedCodec {
|
|
146
|
+
/**
|
|
147
|
+
* Appends a chunk of data to compress/decompress
|
|
148
|
+
*
|
|
149
|
+
* @param data The chunk of data to append.
|
|
150
|
+
*/
|
|
151
|
+
push(data: Uint8Array): void
|
|
152
|
+
/**
|
|
153
|
+
* The function called when a chunk of data has been compressed/decompressed.
|
|
154
|
+
*
|
|
155
|
+
* @param data The chunk of compressed/decompressed data.
|
|
156
|
+
*/
|
|
157
|
+
ondata(data?: Uint8Array): void
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Represents the implementations zip.js uses to compress/decompress data.
|
|
162
|
+
*/
|
|
26
163
|
interface ZipLibrary {
|
|
27
|
-
|
|
164
|
+
/**
|
|
165
|
+
* The class used to compress data.
|
|
166
|
+
*
|
|
167
|
+
* @defaultValue `ZipDeflate`
|
|
168
|
+
*/
|
|
169
|
+
Deflate: typeof ZipDeflate
|
|
170
|
+
/**
|
|
171
|
+
* The class used to decompress data.
|
|
172
|
+
*
|
|
173
|
+
* @defaultValue `ZipInflate`
|
|
174
|
+
*/
|
|
28
175
|
Inflate: typeof ZipInflate
|
|
29
176
|
}
|
|
30
177
|
|
|
178
|
+
/**
|
|
179
|
+
* Represents an intance used to compress data.
|
|
180
|
+
*/
|
|
31
181
|
declare class ZipDeflate {
|
|
32
|
-
|
|
182
|
+
/**
|
|
183
|
+
* Appends a chunk of decompressed data to compress
|
|
184
|
+
*
|
|
185
|
+
* @param data The chunk of decompressed data to append.
|
|
186
|
+
* @returns A chunk of compressed data.
|
|
187
|
+
*/
|
|
188
|
+
append(data: Uint8Array): Uint8Array
|
|
189
|
+
/**
|
|
190
|
+
* Flushes the data
|
|
191
|
+
*
|
|
192
|
+
* @returns A chunk of compressed data.
|
|
193
|
+
*/
|
|
33
194
|
flush(): Uint8Array
|
|
34
195
|
}
|
|
35
196
|
|
|
197
|
+
/**
|
|
198
|
+
* Represents a codec used to decompress data.
|
|
199
|
+
*/
|
|
36
200
|
declare class ZipInflate {
|
|
37
|
-
|
|
201
|
+
/**
|
|
202
|
+
* Appends a chunk of compressed data to decompress
|
|
203
|
+
*
|
|
204
|
+
* @param data The chunk of compressed data to append.
|
|
205
|
+
* @returns A chunk of decompressed data.
|
|
206
|
+
*/
|
|
207
|
+
append(data: Uint8Array): Uint8Array
|
|
208
|
+
/**
|
|
209
|
+
* Flushes the data
|
|
210
|
+
*/
|
|
38
211
|
flush(): void
|
|
39
212
|
}
|
|
40
213
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
flush(): Promise<Uint8Array>;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function getMimeType(fileExtension: string): string;
|
|
214
|
+
/**
|
|
215
|
+
* Returns the MIME type corresponding to a filename extension.
|
|
216
|
+
*
|
|
217
|
+
* @param fileExtension the extension of the filename.
|
|
218
|
+
* @returns The corresponding MIME type.
|
|
219
|
+
*/
|
|
220
|
+
export function getMimeType(fileExtension: string): string
|
|
52
221
|
|
|
222
|
+
/**
|
|
223
|
+
* Represents an instance used to read or write any type of data.
|
|
224
|
+
*
|
|
225
|
+
* zip.js can handle multiple types of data thanks to a generic API. This feature is based on 2 abstract constructors: `Reader` and `Writer`.
|
|
226
|
+
* The classes inheriting from `Reader` help to read data from a source of data. The classes inheriting from `Writer` help to write data into a destination.
|
|
227
|
+
*/
|
|
53
228
|
interface DataProcessor {
|
|
54
|
-
|
|
55
|
-
|
|
229
|
+
/**
|
|
230
|
+
* The total size of the read/written data in bytes.
|
|
231
|
+
*/
|
|
232
|
+
size: number
|
|
233
|
+
/**
|
|
234
|
+
* Initializes the instance asynchronously
|
|
235
|
+
*
|
|
236
|
+
*/
|
|
237
|
+
init?(): Promise<void>
|
|
56
238
|
}
|
|
57
239
|
|
|
240
|
+
/**
|
|
241
|
+
* Represents an instance used to read data from a `ReadableStream` instance.
|
|
242
|
+
*/
|
|
58
243
|
interface ReadableReader {
|
|
59
|
-
|
|
244
|
+
/**
|
|
245
|
+
* The `ReadableStream` instance.
|
|
246
|
+
*/
|
|
247
|
+
readable: ReadableStream
|
|
60
248
|
}
|
|
61
249
|
|
|
250
|
+
/**
|
|
251
|
+
* Represents a `Reader` instance used to read any type of data.
|
|
252
|
+
*/
|
|
62
253
|
export class Reader<Type> implements ReadableReader, DataProcessor {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
254
|
+
/**
|
|
255
|
+
* Creates the `Reader` instance
|
|
256
|
+
*
|
|
257
|
+
* @param value The data to read.
|
|
258
|
+
*/
|
|
259
|
+
constructor(value: Type)
|
|
260
|
+
/**
|
|
261
|
+
* The `ReadableStream` instance.
|
|
262
|
+
*/
|
|
263
|
+
readable: ReadableStream
|
|
264
|
+
/**
|
|
265
|
+
* The total size of the data in bytes.
|
|
266
|
+
*/
|
|
267
|
+
size: number
|
|
268
|
+
/**
|
|
269
|
+
* Initializes the instance asynchronously
|
|
270
|
+
*
|
|
271
|
+
*/
|
|
272
|
+
init?(): Promise<void>
|
|
273
|
+
/**
|
|
274
|
+
* Reads a chunk of data
|
|
275
|
+
*
|
|
276
|
+
* @param index The byte index of the data to read.
|
|
277
|
+
* @param length The length of the data to read in bytes.
|
|
278
|
+
* @returns A promise resolving to a chunk of data.
|
|
279
|
+
*/
|
|
280
|
+
readUint8Array(index: number, length: number): Promise<Uint8Array>
|
|
68
281
|
}
|
|
69
282
|
|
|
70
|
-
|
|
71
|
-
|
|
283
|
+
/**
|
|
284
|
+
* Represents a `Reader` instance used to read data provided as a `string`.
|
|
285
|
+
*/
|
|
286
|
+
export class TextReader extends Reader<string> { }
|
|
72
287
|
|
|
73
|
-
|
|
74
|
-
|
|
288
|
+
/**
|
|
289
|
+
* Represents a `Reader` instance used to read data provided as a `Blob` instance.
|
|
290
|
+
*/
|
|
291
|
+
export class BlobReader extends Reader<Blob> { }
|
|
75
292
|
|
|
76
|
-
|
|
77
|
-
|
|
293
|
+
/**
|
|
294
|
+
* Represents a `Reader` instance used to read data provided as a Data URI `string` encoded in Base64.
|
|
295
|
+
*/
|
|
296
|
+
export class Data64URIReader extends Reader<string> { }
|
|
78
297
|
|
|
79
|
-
|
|
80
|
-
|
|
298
|
+
/**
|
|
299
|
+
* Represents a `Reader` instance used to read data provided as a `Uint8Array` instance.
|
|
300
|
+
*/
|
|
301
|
+
export class Uint8ArrayReader extends Reader<Uint8Array> { }
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Represents a URL stored into a `string`.
|
|
305
|
+
*/
|
|
306
|
+
interface URLString extends String { }
|
|
81
307
|
|
|
82
|
-
|
|
83
|
-
|
|
308
|
+
/**
|
|
309
|
+
* Represents a `Reader` instance used to fetch data from a URL.
|
|
310
|
+
*/
|
|
311
|
+
export class HttpReader extends Reader<URLString> {
|
|
312
|
+
/**
|
|
313
|
+
* Creates the `HttpReader` instance
|
|
314
|
+
*
|
|
315
|
+
* @param url The URL of the data.
|
|
316
|
+
* @param options The options.
|
|
317
|
+
*/
|
|
318
|
+
constructor(url: URLString, options?: HttpOptions)
|
|
84
319
|
}
|
|
85
320
|
|
|
86
|
-
|
|
87
|
-
|
|
321
|
+
/**
|
|
322
|
+
* Represents a `Reader` instance used to fetch data from servers returning `Accept-Ranges` headers.
|
|
323
|
+
*/
|
|
324
|
+
export class HttpRangeReader extends HttpReader {
|
|
325
|
+
/**
|
|
326
|
+
* Creates the `HttpRangeReader` instance
|
|
327
|
+
*
|
|
328
|
+
* @param url The URL of the data.
|
|
329
|
+
* @param options The options.
|
|
330
|
+
*/
|
|
331
|
+
constructor(url: URLString, options?: HttpRangeOptions)
|
|
88
332
|
}
|
|
89
333
|
|
|
334
|
+
/**
|
|
335
|
+
* Represents the options passed to the constructor of `HttpReader`.
|
|
336
|
+
*/
|
|
90
337
|
interface HttpOptions extends HttpRangeOptions {
|
|
91
|
-
|
|
92
|
-
|
|
338
|
+
/**
|
|
339
|
+
* `true` to use `Range` headers when fetching data from servers returning `Accept-Ranges` headers.
|
|
340
|
+
*
|
|
341
|
+
* @defaultValue false
|
|
342
|
+
*/
|
|
343
|
+
useRangeHeader?: boolean
|
|
344
|
+
/**
|
|
345
|
+
* `true` to always use `Range` headers when fetching data.
|
|
346
|
+
*
|
|
347
|
+
* @defaultValue false
|
|
348
|
+
*/
|
|
349
|
+
forceRangeRequests?: boolean
|
|
350
|
+
/**
|
|
351
|
+
* `true` to prevent using `HEAD` HTTP request in order the get the size of the content.
|
|
352
|
+
*
|
|
353
|
+
* @defaultValue false
|
|
354
|
+
*/
|
|
355
|
+
preventHeadRequest?: boolean
|
|
93
356
|
}
|
|
94
357
|
|
|
358
|
+
/**
|
|
359
|
+
* Represents options passed to the constructor of `HttpRangeReader` and `HttpReader`.
|
|
360
|
+
*/
|
|
95
361
|
interface HttpRangeOptions {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
362
|
+
/**
|
|
363
|
+
* `true` to rely `XMLHttpRequest` instead of `fetch` to fetch data.
|
|
364
|
+
*
|
|
365
|
+
* @defaultValue false
|
|
366
|
+
*/
|
|
367
|
+
useXHR?: boolean
|
|
368
|
+
/**
|
|
369
|
+
* The HTTP headers.
|
|
370
|
+
*/
|
|
371
|
+
headers?: Iterable<[string, string]> | Map<string, string>
|
|
99
372
|
}
|
|
100
373
|
|
|
374
|
+
/**
|
|
375
|
+
* Represents an instance used to write data into a `WritableStream` instance.
|
|
376
|
+
*/
|
|
101
377
|
interface WritableWriter {
|
|
102
|
-
|
|
378
|
+
/**
|
|
379
|
+
* The `WritableStream` instance.
|
|
380
|
+
*/
|
|
381
|
+
writable: WritableStream
|
|
103
382
|
}
|
|
104
383
|
|
|
384
|
+
/**
|
|
385
|
+
* Represents a `Writer` instance used to write any type of data.
|
|
386
|
+
*/
|
|
105
387
|
export class Writer<Type> implements DataProcessor, WritableWriter {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
388
|
+
/**
|
|
389
|
+
* The `WritableStream` instance.
|
|
390
|
+
*/
|
|
391
|
+
writable: WritableStream
|
|
392
|
+
/**
|
|
393
|
+
* The total size of the data in bytes.
|
|
394
|
+
*/
|
|
395
|
+
size: number
|
|
396
|
+
/**
|
|
397
|
+
* Initializes the instance asynchronously
|
|
398
|
+
*
|
|
399
|
+
*/
|
|
400
|
+
init?(): Promise<void>
|
|
401
|
+
/**
|
|
402
|
+
* Appends a chunk of data
|
|
403
|
+
*
|
|
404
|
+
* @param array The chunk data to append.
|
|
405
|
+
*/
|
|
406
|
+
writeUint8Array(array: Uint8Array): Promise<void>
|
|
407
|
+
/**
|
|
408
|
+
* Retrieves all the written data
|
|
409
|
+
*
|
|
410
|
+
* @returns A promise resolving to the written data.
|
|
411
|
+
*/
|
|
412
|
+
getData(): Promise<Type>
|
|
111
413
|
}
|
|
112
414
|
|
|
415
|
+
/**
|
|
416
|
+
* Represents a `Writer` instance used to retrieve the written data as a `string`.
|
|
417
|
+
*/
|
|
113
418
|
export class TextWriter extends Writer<string> {
|
|
114
|
-
|
|
419
|
+
/**
|
|
420
|
+
* Creates the `TextWriter` instance
|
|
421
|
+
*
|
|
422
|
+
* @param encoding The encoding of the text.
|
|
423
|
+
*/
|
|
424
|
+
constructor(encoding?: string)
|
|
115
425
|
}
|
|
116
426
|
|
|
427
|
+
/**
|
|
428
|
+
* Represents a `Writer` instance used to retrieve the written data as a `Blob` instance.
|
|
429
|
+
*/
|
|
117
430
|
export class BlobWriter extends Writer<Blob> {
|
|
118
|
-
|
|
431
|
+
/**
|
|
432
|
+
* Creates the `BlobWriter` instance
|
|
433
|
+
*
|
|
434
|
+
* @param mimeString The MIME type of the content.
|
|
435
|
+
*/
|
|
436
|
+
constructor(mimeString?: string)
|
|
119
437
|
}
|
|
120
438
|
|
|
439
|
+
/**
|
|
440
|
+
* Represents a `Writer` instance used to retrieve the written data as a Data URI `string` encoded in Base64.
|
|
441
|
+
*/
|
|
121
442
|
export class Data64URIWriter extends Writer<string> {
|
|
122
|
-
|
|
443
|
+
/**
|
|
444
|
+
* Creates the `Data64URIWriter` instance
|
|
445
|
+
*
|
|
446
|
+
* @param mimeString The MIME type of the content.
|
|
447
|
+
*/
|
|
448
|
+
constructor(mimeString?: string)
|
|
123
449
|
}
|
|
124
450
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
451
|
+
/**
|
|
452
|
+
* Represents a `Writer` instance used to retrieve the written data as a `Uint8Array` instance.
|
|
453
|
+
*/
|
|
454
|
+
export class Uint8ArrayWriter extends Writer<Uint8Array> { }
|
|
128
455
|
|
|
129
|
-
|
|
130
|
-
|
|
456
|
+
/**
|
|
457
|
+
* Represents a `ZipReader` instance used to read a zip file.
|
|
458
|
+
*
|
|
459
|
+
* Example:
|
|
460
|
+
* ```
|
|
461
|
+
* // create a BlobReader to read with a ZipReader the zip from a Blob object
|
|
462
|
+
* const reader = new zip.ZipReader(new zip.BlobReader(blob));
|
|
463
|
+
*
|
|
464
|
+
* // get all entries from the zip
|
|
465
|
+
* const entries = await reader.getEntries();
|
|
466
|
+
* if (entries.length) {
|
|
467
|
+
*
|
|
468
|
+
* // get first entry content as text by using a TextWriter
|
|
469
|
+
* const text = await entries[0].getData(
|
|
470
|
+
* // writer
|
|
471
|
+
* new zip.TextWriter(),
|
|
472
|
+
* // options
|
|
473
|
+
* {
|
|
474
|
+
* onprogress: (index, max) => {
|
|
475
|
+
* // onprogress callback
|
|
476
|
+
* }
|
|
477
|
+
* }
|
|
478
|
+
* );
|
|
479
|
+
* // text contains the entry data as a String
|
|
480
|
+
* console.log(text);
|
|
481
|
+
* }
|
|
482
|
+
*
|
|
483
|
+
* // close the ZipReader
|
|
484
|
+
* await reader.close();
|
|
485
|
+
* ```
|
|
486
|
+
*/
|
|
487
|
+
export class ZipReader<Type> {
|
|
488
|
+
/**
|
|
489
|
+
* Creates the `ZipReader` instance
|
|
490
|
+
*
|
|
491
|
+
* @param reader The `Reader` instance used to read data.
|
|
492
|
+
* @param options The options.
|
|
493
|
+
*/
|
|
494
|
+
constructor(reader: Reader<Type> | ReadableReader, options?: ZipReaderConstructorOptions)
|
|
495
|
+
/**
|
|
496
|
+
* The global comment of the zip file.
|
|
497
|
+
*/
|
|
498
|
+
comment: Uint8Array
|
|
499
|
+
/**
|
|
500
|
+
* The data prepended before the zip file.
|
|
501
|
+
*/
|
|
502
|
+
prependedData?: Uint8Array
|
|
503
|
+
/**
|
|
504
|
+
* The data appended after the zip file.
|
|
505
|
+
*/
|
|
506
|
+
appendedData?: Uint8Array
|
|
507
|
+
/**
|
|
508
|
+
* Returns all the entries in the zip file
|
|
509
|
+
*
|
|
510
|
+
* @param options The options.
|
|
511
|
+
* @returns A promise resolving to an `array` of `Entry` instances.
|
|
512
|
+
*/
|
|
513
|
+
getEntries(options?: ZipReaderGetEntriesOptions): Promise<Entry[]>
|
|
514
|
+
/**
|
|
515
|
+
* Returns a generator used to iterate on all the entries in the zip file
|
|
516
|
+
*
|
|
517
|
+
* @param options The options.
|
|
518
|
+
* @returns An asynchrounous generator of `Entry` instances.
|
|
519
|
+
*/
|
|
520
|
+
getEntriesGenerator(options?: ZipReaderGetEntriesOptions): AsyncGenerator<Entry, boolean>
|
|
521
|
+
/**
|
|
522
|
+
* Closes the zip file
|
|
523
|
+
*/
|
|
524
|
+
close(): Promise<void>
|
|
131
525
|
}
|
|
132
526
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
527
|
+
/**
|
|
528
|
+
* Represents the options passed to the constructor of `ZipReader`, and `ZipDirectoryEntry#import*()`.
|
|
529
|
+
*/
|
|
530
|
+
interface ZipReaderConstructorOptions extends ZipReaderOptions, GetEntriesOptions, WorkerConfiguration {
|
|
531
|
+
/**
|
|
532
|
+
* `true` to extract the prepended data into `ZipReader#prependedData`.
|
|
533
|
+
*
|
|
534
|
+
* @defaultValue false
|
|
535
|
+
*/
|
|
536
|
+
extractPrependedData?: boolean
|
|
537
|
+
/**
|
|
538
|
+
* `true` to extract the appended data into `ZipReader#appendedData`.
|
|
539
|
+
*
|
|
540
|
+
* @defaultValue false
|
|
541
|
+
*/
|
|
542
|
+
extractAppendedData?: boolean
|
|
141
543
|
}
|
|
142
544
|
|
|
143
|
-
|
|
545
|
+
/**
|
|
546
|
+
* Represents the options passed to `ZipReader#getEntries()` and `ZipReader#getEntriesGenerator()`.
|
|
547
|
+
*/
|
|
548
|
+
interface ZipReaderGetEntriesOptions extends GetEntriesOptions, EntryOnprogressOptions { }
|
|
144
549
|
|
|
145
|
-
|
|
550
|
+
/**
|
|
551
|
+
* Represents options passed to the constructor of `ZipReader`, `ZipReader#getEntries()` and `ZipReader#getEntriesGenerator()`.
|
|
552
|
+
*/
|
|
553
|
+
interface GetEntriesOptions {
|
|
554
|
+
/**
|
|
555
|
+
* The encoding of the filename of the entry.
|
|
556
|
+
*/
|
|
557
|
+
filenameEncoding?: string
|
|
558
|
+
/**
|
|
559
|
+
* The encoding of the comment of the entry.
|
|
560
|
+
*/
|
|
561
|
+
commentEncoding?: string
|
|
562
|
+
}
|
|
146
563
|
|
|
564
|
+
/**
|
|
565
|
+
* Represents options passed to the constructor of `ZipReader` and `Entry#getData()`.
|
|
566
|
+
*/
|
|
147
567
|
interface ZipReaderOptions {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
568
|
+
/**
|
|
569
|
+
* `true` to check the signature of the entry.
|
|
570
|
+
*
|
|
571
|
+
* @defaultValue false
|
|
572
|
+
*/
|
|
573
|
+
checkSignature?: boolean
|
|
574
|
+
/**
|
|
575
|
+
* The password used to decrypt the content of the entry.
|
|
576
|
+
*/
|
|
577
|
+
password?: string
|
|
578
|
+
/**
|
|
579
|
+
* The `AbortSignal` instance used to cancel the decompression.
|
|
580
|
+
*/
|
|
581
|
+
signal?: AbortSignal
|
|
155
582
|
}
|
|
156
583
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
584
|
+
/**
|
|
585
|
+
* Represents an entry in a zip file (Core API).
|
|
586
|
+
*/
|
|
587
|
+
export interface Entry {
|
|
588
|
+
/**
|
|
589
|
+
* The byte offset of the entry.
|
|
590
|
+
*/
|
|
591
|
+
offset: number
|
|
592
|
+
/**
|
|
593
|
+
* The filename of the entry.
|
|
594
|
+
*/
|
|
595
|
+
filename: string
|
|
596
|
+
/**
|
|
597
|
+
* The filename of the entry (raw).
|
|
598
|
+
*/
|
|
599
|
+
rawFilename: Uint8Array
|
|
600
|
+
/**
|
|
601
|
+
* `true` if the filename is encoded in UTF-8.
|
|
602
|
+
*/
|
|
603
|
+
filenameUTF8: boolean
|
|
604
|
+
/**
|
|
605
|
+
* `true` if the entry is a directory.
|
|
606
|
+
*/
|
|
607
|
+
directory: boolean
|
|
608
|
+
/**
|
|
609
|
+
* `true` if the content of the entry is encrypted.
|
|
610
|
+
*/
|
|
611
|
+
encrypted: boolean
|
|
612
|
+
/**
|
|
613
|
+
* The size of the compressed data in bytes.
|
|
614
|
+
*/
|
|
615
|
+
compressedSize: number
|
|
616
|
+
/**
|
|
617
|
+
* The size of the decompressed data in bytes.
|
|
618
|
+
*/
|
|
619
|
+
uncompressedSize: number
|
|
620
|
+
/**
|
|
621
|
+
* The last modification date.
|
|
622
|
+
*/
|
|
623
|
+
lastModDate: Date
|
|
624
|
+
/**
|
|
625
|
+
* The last access date.
|
|
626
|
+
*/
|
|
627
|
+
lastAccessDate?: Date
|
|
628
|
+
/**
|
|
629
|
+
* The creation date.
|
|
630
|
+
*/
|
|
631
|
+
creationDate?: Date
|
|
632
|
+
/**
|
|
633
|
+
* The last modification date (raw).
|
|
634
|
+
*/
|
|
635
|
+
rawLastModDate: number | bigint
|
|
636
|
+
/**
|
|
637
|
+
* The last access date (raw).
|
|
638
|
+
*/
|
|
639
|
+
rawLastAccessDate?: number | bigint
|
|
640
|
+
/**
|
|
641
|
+
* The creation date (raw).
|
|
642
|
+
*/
|
|
643
|
+
rawCreationDate?: number | bigint
|
|
644
|
+
/**
|
|
645
|
+
* The comment of the entry.
|
|
646
|
+
*/
|
|
647
|
+
comment: string
|
|
648
|
+
/**
|
|
649
|
+
* The comment of the entry (raw).
|
|
650
|
+
*/
|
|
651
|
+
rawComment: Uint8Array
|
|
652
|
+
/**
|
|
653
|
+
* `true` if the comment is encoded in UTF-8.
|
|
654
|
+
*/
|
|
655
|
+
commentUTF8: boolean
|
|
656
|
+
/**
|
|
657
|
+
* The signature (CRC32 checksum) of the content.
|
|
658
|
+
*/
|
|
659
|
+
signature: number
|
|
660
|
+
/**
|
|
661
|
+
* The extra field.
|
|
662
|
+
*/
|
|
663
|
+
extraField?: Map<number, Uint8Array>
|
|
664
|
+
/**
|
|
665
|
+
* The extra field (raw).
|
|
666
|
+
*/
|
|
667
|
+
rawExtraField: Uint8Array
|
|
668
|
+
/**
|
|
669
|
+
* `true` if the entry is using Zip64.
|
|
670
|
+
*/
|
|
671
|
+
zip64: boolean
|
|
672
|
+
/**
|
|
673
|
+
* The "Version" field.
|
|
674
|
+
*/
|
|
675
|
+
version: number
|
|
676
|
+
/**
|
|
677
|
+
* The "Version made by" field.
|
|
678
|
+
*/
|
|
679
|
+
versionMadeBy: number
|
|
680
|
+
/**
|
|
681
|
+
* `true` if "Version made by" equals to 0.
|
|
682
|
+
*/
|
|
683
|
+
msDosCompatible: boolean
|
|
684
|
+
/**
|
|
685
|
+
* The internal file attribute (raw).
|
|
686
|
+
*/
|
|
687
|
+
internalFileAttribute: number
|
|
688
|
+
/**
|
|
689
|
+
* The external file attribute (raw).
|
|
690
|
+
*/
|
|
691
|
+
externalFileAttribute: number
|
|
692
|
+
/**
|
|
693
|
+
* Returns the content of the entry
|
|
694
|
+
*
|
|
695
|
+
* @param writer The `Writer` instance used to write the content of the entry.
|
|
696
|
+
* @param options The options.
|
|
697
|
+
* @returns A promise resolving to the type to data associated to `writer`.
|
|
698
|
+
*/
|
|
699
|
+
getData?<Type>(writer: Writer<Type> | WritableWriter, options?: EntryGetDataOptions): Promise<Type>
|
|
160
700
|
}
|
|
161
701
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
filenameUTF8: boolean;
|
|
167
|
-
directory: boolean;
|
|
168
|
-
encrypted: boolean;
|
|
169
|
-
compressedSize: number;
|
|
170
|
-
uncompressedSize: number;
|
|
171
|
-
lastModDate: Date;
|
|
172
|
-
lastAccessDate?: Date;
|
|
173
|
-
creationDate?: Date;
|
|
174
|
-
rawLastModDate: number;
|
|
175
|
-
rawLastAccessDate?: Date;
|
|
176
|
-
rawCreationDate?: Date;
|
|
177
|
-
comment: string;
|
|
178
|
-
rawComment: Uint8Array;
|
|
179
|
-
commentUTF8: boolean;
|
|
180
|
-
signature: Uint8Array;
|
|
181
|
-
extraField?: Map<number, Uint8Array>;
|
|
182
|
-
rawExtraField: Uint8Array;
|
|
183
|
-
zip64: boolean;
|
|
184
|
-
version: number;
|
|
185
|
-
versionMadeBy: number;
|
|
186
|
-
msDosCompatible: boolean;
|
|
187
|
-
internalFileAttribute: number;
|
|
188
|
-
externalFileAttribute: number;
|
|
189
|
-
getData?<Type>(writer: Writer<Type> | WritableWriter, options?: EntryGetDataOptions): Promise<Type>;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
type EntryGetDataOptions = EntryDataOnprogressOption & ZipReaderOptions;
|
|
702
|
+
/**
|
|
703
|
+
* Represents the options passed to `Entry#getData()` and `ZipFileEntry.get*()`.
|
|
704
|
+
*/
|
|
705
|
+
interface EntryGetDataOptions extends EntryDataOnprogressOptions, ZipReaderOptions, WorkerConfiguration { }
|
|
193
706
|
|
|
707
|
+
/**
|
|
708
|
+
* Represents a `ZipWriter` instance used to create a zip file.
|
|
709
|
+
*
|
|
710
|
+
* Example:
|
|
711
|
+
* ```
|
|
712
|
+
* // use a BlobWriter to store with a ZipWriter the zip into a Blob object
|
|
713
|
+
* const blobWriter = new zip.BlobWriter("application/zip");
|
|
714
|
+
* const writer = new zip.ZipWriter(blobWriter);
|
|
715
|
+
*
|
|
716
|
+
* // use a TextReader to read the String to add
|
|
717
|
+
* await writer.add("filename.txt", new zip.TextReader("test!"));
|
|
718
|
+
*
|
|
719
|
+
* // close the ZipReader
|
|
720
|
+
* await writer.close();
|
|
721
|
+
*
|
|
722
|
+
* // get the zip file as a Blob
|
|
723
|
+
* const blob = blobWriter.getData();
|
|
724
|
+
* ```
|
|
725
|
+
*/
|
|
194
726
|
export class ZipWriter<Type> {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
727
|
+
/**
|
|
728
|
+
* Creates the `ZipWriter` instance
|
|
729
|
+
*
|
|
730
|
+
* @param writer The `Writer` instance where the zip content will be written.
|
|
731
|
+
* @param options The options.
|
|
732
|
+
*/
|
|
733
|
+
constructor(writer: Writer<Type> | WritableWriter, options?: ZipWriterConstructorOptions)
|
|
734
|
+
/**
|
|
735
|
+
* `true` if the zip contains at least one entry that has been partially written.
|
|
736
|
+
*/
|
|
737
|
+
readonly hasCorruptedEntries?: boolean
|
|
738
|
+
/**
|
|
739
|
+
* Adds an entry into the zip file
|
|
740
|
+
*
|
|
741
|
+
* @param filename The filename of the entry.
|
|
742
|
+
* @param reader The `Reader` instance used to read the content of the entry.
|
|
743
|
+
* @param options The options.
|
|
744
|
+
* @returns A promise resolving to an `Entry` instance.
|
|
745
|
+
*/
|
|
746
|
+
add<ReaderType>(filename: string, reader: Reader<ReaderType> | ReadableReader | void, options?: ZipWriterAddDataOptions): Promise<Entry>
|
|
747
|
+
/**
|
|
748
|
+
* Writes the entries directory, writes the global comment, and returns the content of the zip file
|
|
749
|
+
*
|
|
750
|
+
* @param comment The global comment of the zip file.
|
|
751
|
+
* @param options The options.
|
|
752
|
+
* @returns The content of the zip file.
|
|
753
|
+
*/
|
|
754
|
+
close(comment: Uint8Array | void, options?: ZipWriterCloseOptions): Promise<Type>
|
|
199
755
|
}
|
|
200
756
|
|
|
201
|
-
|
|
757
|
+
/**
|
|
758
|
+
* Represents the options passed to `ZipWriter#add()`.
|
|
759
|
+
*/
|
|
760
|
+
interface ZipWriterAddDataOptions extends ZipWriterConstructorOptions, EntryDataOnprogressOptions, WorkerConfiguration {
|
|
761
|
+
/**
|
|
762
|
+
* `true` if the entry is a directory.
|
|
763
|
+
*
|
|
764
|
+
* @defaultValue false
|
|
765
|
+
*/
|
|
766
|
+
directory?: boolean
|
|
767
|
+
/**
|
|
768
|
+
* The comment of the entry.
|
|
769
|
+
*/
|
|
770
|
+
comment?: string
|
|
771
|
+
/**
|
|
772
|
+
* The extra field of the entry.
|
|
773
|
+
*/
|
|
774
|
+
extraField?: Map<number, Uint8Array>
|
|
775
|
+
}
|
|
202
776
|
|
|
203
|
-
|
|
777
|
+
/**
|
|
778
|
+
* Represents the options passed to `ZipWriter#close()`.
|
|
779
|
+
*/
|
|
780
|
+
interface ZipWriterCloseOptions extends EntryOnprogressOptions {
|
|
781
|
+
/**
|
|
782
|
+
* `true` to use Zip64 to write the entries directory.
|
|
783
|
+
*
|
|
784
|
+
* @defaultValue false
|
|
785
|
+
*/
|
|
786
|
+
zip64?: boolean
|
|
787
|
+
/**
|
|
788
|
+
* `true` to prevent closing of `Writer#writable`.
|
|
789
|
+
*
|
|
790
|
+
* @defaultValue false
|
|
791
|
+
*/
|
|
792
|
+
preventClose?: boolean
|
|
793
|
+
}
|
|
204
794
|
|
|
795
|
+
/**
|
|
796
|
+
* Represents options passed to the constructor of `ZipWriter`, `ZipWriter#add()` and `ZipDirectoryEntry#export*()`.
|
|
797
|
+
*/
|
|
205
798
|
interface ZipWriterConstructorOptions {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
799
|
+
/**
|
|
800
|
+
* `true` to use Zip64 to store the entry.
|
|
801
|
+
*
|
|
802
|
+
* @defaultValue false
|
|
803
|
+
*/
|
|
804
|
+
zip64?: boolean
|
|
805
|
+
/**
|
|
806
|
+
* The level of compression.
|
|
807
|
+
*
|
|
808
|
+
* @defaultValue 5
|
|
809
|
+
*/
|
|
810
|
+
level?: number
|
|
811
|
+
/**
|
|
812
|
+
* `true` to write entry data in a buffer before appending it to the zip file.
|
|
813
|
+
*
|
|
814
|
+
* @defaultValue false
|
|
815
|
+
*/
|
|
816
|
+
bufferedWrite?: boolean
|
|
817
|
+
/**
|
|
818
|
+
* `true` to keep the order of the entry physically in the zip file.
|
|
819
|
+
*
|
|
820
|
+
* @defaultValue true
|
|
821
|
+
*/
|
|
822
|
+
keepOrder?: boolean
|
|
823
|
+
/**
|
|
824
|
+
* The "Version" field.
|
|
825
|
+
*/
|
|
826
|
+
version?: number
|
|
827
|
+
/**
|
|
828
|
+
* The password used to encrypt the content of the entry.
|
|
829
|
+
*/
|
|
830
|
+
password?: string
|
|
831
|
+
/**
|
|
832
|
+
* The encryption strength (AES).
|
|
833
|
+
*
|
|
834
|
+
* @defaultValue 3
|
|
835
|
+
*/
|
|
836
|
+
encryptionStrength?: 1 | 2 | 3
|
|
837
|
+
/**
|
|
838
|
+
* `true` to use the ZipCrypto algorithm to encrypt the content of the entry.
|
|
839
|
+
*
|
|
840
|
+
* @defaultValue false
|
|
841
|
+
*/
|
|
842
|
+
zipCrypto?: boolean
|
|
843
|
+
/**
|
|
844
|
+
* `true` to to add a data descriptor.
|
|
845
|
+
*
|
|
846
|
+
* @defaultValue true
|
|
847
|
+
*/
|
|
848
|
+
dataDescriptor?: boolean
|
|
849
|
+
/**
|
|
850
|
+
* `true` to add the signature of the data descriptor.
|
|
851
|
+
*
|
|
852
|
+
* @defaultValue false
|
|
853
|
+
*/
|
|
854
|
+
dataDescriptorSignature?: boolean
|
|
855
|
+
/**
|
|
856
|
+
* The `AbortSignal` instance used to cancel the compression.
|
|
857
|
+
*/
|
|
858
|
+
signal?: AbortSignal
|
|
859
|
+
/**
|
|
860
|
+
* The last modification date.
|
|
861
|
+
*
|
|
862
|
+
* @defaultValue The current date.
|
|
863
|
+
*/
|
|
864
|
+
lastModDate?: Date
|
|
865
|
+
/**
|
|
866
|
+
* The last access date.
|
|
867
|
+
*
|
|
868
|
+
* @defaultValue The current date.
|
|
869
|
+
*/
|
|
870
|
+
lastAccessDate?: Date
|
|
871
|
+
/**
|
|
872
|
+
* The creation date.
|
|
873
|
+
*
|
|
874
|
+
* @defaultValue The current date.
|
|
875
|
+
*/
|
|
876
|
+
creationDate?: Date
|
|
877
|
+
/**
|
|
878
|
+
* `true` to store extended timestamp extra fields.
|
|
879
|
+
*
|
|
880
|
+
* @defaultValue true
|
|
881
|
+
*/
|
|
882
|
+
extendedTimestamp?: boolean
|
|
883
|
+
/**
|
|
884
|
+
* `true` to write `internalFileAttribute` and `externalFileAttribute` in MS-DOS format.
|
|
885
|
+
*
|
|
886
|
+
* @defaultValue true
|
|
887
|
+
*/
|
|
888
|
+
msDosCompatible?: boolean
|
|
889
|
+
/**
|
|
890
|
+
* The internal file attribute.
|
|
891
|
+
*
|
|
892
|
+
* @defaultValue 0
|
|
893
|
+
*/
|
|
894
|
+
internalFileAttribute?: number
|
|
895
|
+
/**
|
|
896
|
+
* The external file attribute.
|
|
897
|
+
*
|
|
898
|
+
* @defaultValue 0
|
|
899
|
+
*/
|
|
900
|
+
externalFileAttribute?: number
|
|
226
901
|
}
|
|
227
902
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
903
|
+
/**
|
|
904
|
+
* Represents options passed to `Entry#getData`, `ZipWriter.add()` and `ZipDirectory.export*()`.
|
|
905
|
+
*/
|
|
906
|
+
interface EntryDataOnprogressOptions {
|
|
907
|
+
/**
|
|
908
|
+
* The function called when starting compression/decompression.
|
|
909
|
+
*
|
|
910
|
+
* @param total The total number of bytes.
|
|
911
|
+
* @returns An empty promise or `undefined`.
|
|
912
|
+
*/
|
|
913
|
+
onstart?(total: number): Promise<void> | undefined
|
|
914
|
+
/**
|
|
915
|
+
* The function called during compression/decompression.
|
|
916
|
+
*
|
|
917
|
+
* @param progress The current progress in bytes.
|
|
918
|
+
* @param total The total number of bytes.
|
|
919
|
+
* @returns An empty promise or `undefined`.
|
|
920
|
+
*/
|
|
921
|
+
onprogress?(progress: number, total: number): Promise<void> | undefined
|
|
922
|
+
/**
|
|
923
|
+
* The function called when ending compression/decompression.
|
|
924
|
+
*
|
|
925
|
+
* @param computedSize The total number of bytes (computed).
|
|
926
|
+
* @returns An empty promise or `undefined`.
|
|
927
|
+
*/
|
|
928
|
+
onend?(computedSize: number): Promise<void> | undefined
|
|
232
929
|
}
|
|
233
930
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
931
|
+
/**
|
|
932
|
+
* Represents options passed to `ZipReader#getEntries()`, `ZipReader#getEntriesGenerator()`, and `ZipWriter#close()`.
|
|
933
|
+
*/
|
|
934
|
+
interface EntryOnprogressOptions {
|
|
935
|
+
/**
|
|
936
|
+
* The function called each time an entry is read/written.
|
|
937
|
+
*
|
|
938
|
+
* @param progress The entry index.
|
|
939
|
+
* @param total The total number of entries.
|
|
940
|
+
* @param entry The entry being read/written.
|
|
941
|
+
* @returns An empty promise or `undefined`.
|
|
942
|
+
*/
|
|
943
|
+
onprogress?(progress: number, total: number, entry: Entry): Promise<void> | undefined
|
|
237
944
|
}
|
|
238
945
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
946
|
+
/**
|
|
947
|
+
* Represents an entry in a zip file (Filesystem API).
|
|
948
|
+
*/
|
|
949
|
+
declare class ZipEntry {
|
|
950
|
+
/**
|
|
951
|
+
* The relative filename of the entry.
|
|
952
|
+
*/
|
|
953
|
+
name: string
|
|
954
|
+
/**
|
|
955
|
+
* The underlying `Entry` instance.
|
|
956
|
+
*/
|
|
957
|
+
data?: Entry
|
|
958
|
+
/**
|
|
959
|
+
* The ID of the instance.
|
|
960
|
+
*/
|
|
961
|
+
id: number
|
|
962
|
+
/**
|
|
963
|
+
* The parent directory of the entry.
|
|
964
|
+
*/
|
|
965
|
+
parent?: ZipEntry
|
|
966
|
+
/**
|
|
967
|
+
* The uncompressed size of the content.
|
|
968
|
+
*/
|
|
969
|
+
uncompressedSize: number
|
|
970
|
+
/**
|
|
971
|
+
* The children of the entry.
|
|
972
|
+
*/
|
|
973
|
+
children: ZipEntry[]
|
|
974
|
+
/**
|
|
975
|
+
* Returns the full filename of the entry
|
|
976
|
+
*/
|
|
977
|
+
getFullname(): string
|
|
978
|
+
/**
|
|
979
|
+
* Returns the filename of the entry relative to a parent directory
|
|
980
|
+
*/
|
|
981
|
+
getRelativeName(ancestor: ZipDirectoryEntry): string
|
|
982
|
+
/**
|
|
983
|
+
* Tests if a `ZipDirectoryEntry` instance is an ancestor of the entry
|
|
984
|
+
*
|
|
985
|
+
* @param ancestor The `ZipDirectoryEntry` instance.
|
|
986
|
+
*/
|
|
987
|
+
isDescendantOf(ancestor: ZipDirectoryEntry): boolean
|
|
243
988
|
}
|
|
244
989
|
|
|
245
|
-
|
|
246
|
-
|
|
990
|
+
/**
|
|
991
|
+
* Represents a file entry in the zip (Filesystem API).
|
|
992
|
+
*/
|
|
993
|
+
export class ZipFileEntry<ReaderType, WriterType> extends ZipEntry {
|
|
994
|
+
/**
|
|
995
|
+
* `void` for `ZipFileEntry` instances.
|
|
996
|
+
*/
|
|
997
|
+
directory: void
|
|
998
|
+
/**
|
|
999
|
+
* The `Reader` instance used to read the content of the entry.
|
|
1000
|
+
*/
|
|
1001
|
+
reader: Reader<ReaderType> | ReadableReader
|
|
1002
|
+
/**
|
|
1003
|
+
* The `Writer` instance used to write the content of the entry.
|
|
1004
|
+
*/
|
|
1005
|
+
writer: Writer<WriterType> | WritableWriter
|
|
1006
|
+
/**
|
|
1007
|
+
* Retrieves the text content of the entry as a `string`
|
|
1008
|
+
*
|
|
1009
|
+
* @param encoding The encoding of the text.
|
|
1010
|
+
* @param options The options.
|
|
1011
|
+
* @returns A promise resolving to a `string`.
|
|
1012
|
+
*/
|
|
1013
|
+
getText(encoding: string | void, options?: EntryGetDataOptions): Promise<string>
|
|
1014
|
+
/**
|
|
1015
|
+
* Retrieves the content of the entry as a `Blob` instance
|
|
1016
|
+
*
|
|
1017
|
+
* @param mimeType The MIME type of the content.
|
|
1018
|
+
* @param options The options.
|
|
1019
|
+
* @returns A promise resolving to a `Blob` instance.
|
|
1020
|
+
*/
|
|
1021
|
+
getBlob(mimeType: string | void, options?: EntryGetDataOptions): Promise<Blob>
|
|
1022
|
+
/**
|
|
1023
|
+
* Retrieves the content of the entry as as a Data URI `string` encoded in Base64
|
|
1024
|
+
*
|
|
1025
|
+
* @param mimeType The MIME type of the content.
|
|
1026
|
+
* @param options The options.
|
|
1027
|
+
* @returns A promise resolving to a Data URI `string` encoded in Base64.
|
|
1028
|
+
*/
|
|
1029
|
+
getData64URI(mimeType: string | void, options?: EntryGetDataOptions): Promise<string>
|
|
1030
|
+
/**
|
|
1031
|
+
* Retrieves the content of the entry as a `Uint8Array` instance
|
|
1032
|
+
*
|
|
1033
|
+
* @param options The options.
|
|
1034
|
+
* @returns A promise resolving to a `Uint8Array` instance.
|
|
1035
|
+
*/
|
|
1036
|
+
getUint8Array(options?: EntryGetDataOptions): Promise<Uint8Array>
|
|
1037
|
+
/**
|
|
1038
|
+
* Retrieves the content of the entry via a `WritableStream` instance
|
|
1039
|
+
*
|
|
1040
|
+
* @param writable The `WritableStream` instance.
|
|
1041
|
+
* @param options The options.
|
|
1042
|
+
* @returns A promise resolving to the `WritableStream` instance.
|
|
1043
|
+
*/
|
|
1044
|
+
getWritable(writable: WritableStream | void, options?: EntryGetDataOptions): Promise<WritableStream>
|
|
1045
|
+
/**
|
|
1046
|
+
* Retrieves the content of the entry via a `Writer` instance
|
|
1047
|
+
*
|
|
1048
|
+
* @param writer The `Writer` instance.
|
|
1049
|
+
* @param options The options.
|
|
1050
|
+
* @returns A promise resolving to data associated to the `Writer` instance.
|
|
1051
|
+
*/
|
|
1052
|
+
getData(writer: Writer<WriterType>, options?: EntryGetDataOptions): Promise<WriterType>
|
|
1053
|
+
/**
|
|
1054
|
+
* Replaces the content of the entry with a `Blob` instance
|
|
1055
|
+
*
|
|
1056
|
+
* @param blob The `Blob` instance.
|
|
1057
|
+
*/
|
|
1058
|
+
replaceBlob(blob: Blob): void
|
|
1059
|
+
/**
|
|
1060
|
+
* Replaces the content of the entry with a `string`
|
|
1061
|
+
*
|
|
1062
|
+
* @param text The `string`.
|
|
1063
|
+
*/
|
|
1064
|
+
replaceText(text: string): void
|
|
1065
|
+
/**
|
|
1066
|
+
* Replaces the content of the entry with a Data URI `string` encoded in Base64
|
|
1067
|
+
*
|
|
1068
|
+
* @param dataURI The Data URI `string` encoded in Base64.
|
|
1069
|
+
*/
|
|
1070
|
+
replaceData64URI(dataURI: string): void
|
|
1071
|
+
/**
|
|
1072
|
+
* Replaces the content of the entry with a `Uint8Array` instance
|
|
1073
|
+
*
|
|
1074
|
+
* @param array The `Uint8Array` instance.
|
|
1075
|
+
*/
|
|
1076
|
+
replaceUint8Array(array: Uint8Array): void
|
|
1077
|
+
/**
|
|
1078
|
+
* Replaces the content of the entry with a `ReadableStream` instance
|
|
1079
|
+
*
|
|
1080
|
+
* @param readable The `ReadableStream` instance.
|
|
1081
|
+
*/
|
|
1082
|
+
replaceReadable(readable: ReadableStream): void
|
|
247
1083
|
}
|
|
248
1084
|
|
|
249
|
-
|
|
250
|
-
|
|
1085
|
+
/**
|
|
1086
|
+
* Represents a directory entry in the zip (Filesystem API).
|
|
1087
|
+
*/
|
|
1088
|
+
export class ZipDirectoryEntry extends ZipEntry {
|
|
1089
|
+
/**
|
|
1090
|
+
* `true` for `ZipDirectoryEntry` instances.
|
|
1091
|
+
*/
|
|
1092
|
+
directory: true
|
|
1093
|
+
/**
|
|
1094
|
+
* Gets a `ZipEntry` child instance from its relative filename
|
|
1095
|
+
*
|
|
1096
|
+
* @param name The relative filename.
|
|
1097
|
+
* @returns A `ZipFileEntry` or a `ZipDirectoryEntry` instance (use the `directory` property to differentiate entries).
|
|
1098
|
+
*/
|
|
1099
|
+
getChildByName(name: string): ZipEntry | undefined
|
|
1100
|
+
/**
|
|
1101
|
+
* Adds a directory
|
|
1102
|
+
*
|
|
1103
|
+
* @param name The relative filename of the directory
|
|
1104
|
+
* @returns A `ZipDirectoryEntry` instance.
|
|
1105
|
+
*/
|
|
1106
|
+
addDirectory(name: string): ZipDirectoryEntry
|
|
1107
|
+
/**
|
|
1108
|
+
* Adds an entry with content provided as text
|
|
1109
|
+
*
|
|
1110
|
+
* @param name The relative filename of the entry.
|
|
1111
|
+
* @param text The text.
|
|
1112
|
+
* @returns A `ZipFileEntry` instance.
|
|
1113
|
+
*/
|
|
1114
|
+
addText(name: string, text: string): ZipFileEntry<string, string>
|
|
1115
|
+
/**
|
|
1116
|
+
* Adds aentry entry with content provided as a `Blob` instance
|
|
1117
|
+
*
|
|
1118
|
+
* @param name The relative filename of the entry.
|
|
1119
|
+
* @param blob The `Blob` instance.
|
|
1120
|
+
* @returns A `ZipFileEntry` instance.
|
|
1121
|
+
*/
|
|
1122
|
+
addBlob(name: string, blob: Blob): ZipFileEntry<Blob, Blob>
|
|
1123
|
+
/**
|
|
1124
|
+
* Adds aentry entry with content provided as a Data URI `string` encoded in Base64
|
|
1125
|
+
*
|
|
1126
|
+
* @param name The relative filename of the entry.
|
|
1127
|
+
* @param dataURI The Data URI `string` encoded in Base64.
|
|
1128
|
+
* @returns A `ZipFileEntry` instance.
|
|
1129
|
+
*/
|
|
1130
|
+
addData64URI(name: string, dataURI: string): ZipFileEntry<string, string>
|
|
1131
|
+
/**
|
|
1132
|
+
* Adds an entry with content provided as a `Uint8Array` instance
|
|
1133
|
+
*
|
|
1134
|
+
* @param name The relative filename of the entry.
|
|
1135
|
+
* @param array The `Uint8Array` instance.
|
|
1136
|
+
* @returns A `ZipFileEntry` instance.
|
|
1137
|
+
*/
|
|
1138
|
+
addUint8Array(name: string, array: Uint8Array): ZipFileEntry<Uint8Array, Uint8Array>
|
|
1139
|
+
/**
|
|
1140
|
+
* Adds an entry with content fetched from a URL
|
|
1141
|
+
*
|
|
1142
|
+
* @param name The relative filename of the entry.
|
|
1143
|
+
* @param url The URL.
|
|
1144
|
+
* @param options The options.
|
|
1145
|
+
* @returns A `ZipFileEntry` instance.
|
|
1146
|
+
*/
|
|
1147
|
+
addHttpContent(name: string, url: string, options?: HttpOptions): ZipFileEntry<string, void>
|
|
1148
|
+
/**
|
|
1149
|
+
* Adds aentry entry with content provided via a `ReadableStream` instance
|
|
1150
|
+
*
|
|
1151
|
+
* @param name The relative filename of the entry.
|
|
1152
|
+
* @param readable The `ReadableStream` instance.
|
|
1153
|
+
* @returns A `ZipFileEntry` instance.
|
|
1154
|
+
*/
|
|
1155
|
+
addReadable(name: string, readable: ReadableStream): ZipFileEntry<ReadableStream, void>
|
|
1156
|
+
/**
|
|
1157
|
+
* Adds an entry with content provided via a `FileSystemEntry` instance
|
|
1158
|
+
*
|
|
1159
|
+
* @param fileSystemEntry The `FileSystemEntry` instance.
|
|
1160
|
+
* @returns A promise resolving to a `ZipFileEntry` or a `ZipDirectoryEntry` instance.
|
|
1161
|
+
*/
|
|
1162
|
+
addFileSystemEntry(fileSystemEntry: FileSystemEntry): Promise<ZipEntry>
|
|
1163
|
+
/**
|
|
1164
|
+
* Extracts a zip file provided as a `Blob` instance into the entry
|
|
1165
|
+
*
|
|
1166
|
+
* @param blob The `Blob` instance.
|
|
1167
|
+
* @param options The options.
|
|
1168
|
+
*/
|
|
1169
|
+
importBlob(blob: Blob, options?: ZipReaderConstructorOptions): Promise<void>
|
|
1170
|
+
/**
|
|
1171
|
+
* Extracts a zip file provided as a Data URI `string` encoded in Base64 into the entry
|
|
1172
|
+
*
|
|
1173
|
+
* @param dataURI The Data URI `string` encoded in Base64.
|
|
1174
|
+
* @param options The options.
|
|
1175
|
+
*/
|
|
1176
|
+
importData64URI(dataURI: string, options?: ZipReaderConstructorOptions): Promise<void>
|
|
1177
|
+
/**
|
|
1178
|
+
* Extracts a zip file provided as a `Uint8Array` instance into the entry
|
|
1179
|
+
*
|
|
1180
|
+
* @param array The `Uint8Array` instance.
|
|
1181
|
+
* @param options The options.
|
|
1182
|
+
*/
|
|
1183
|
+
importUint8Array(array: Uint8Array, options?: ZipReaderConstructorOptions): Promise<void>
|
|
1184
|
+
/**
|
|
1185
|
+
* Extracts a zip file fetched from a URL into the entry
|
|
1186
|
+
*
|
|
1187
|
+
* @param url The URL.
|
|
1188
|
+
* @param options The options.
|
|
1189
|
+
*/
|
|
1190
|
+
importHttpContent(url: string, options?: ZipDirectoryEntryImportHttpOptions): Promise<void>
|
|
1191
|
+
/**
|
|
1192
|
+
* Extracts a zip file provided via a `ReadableStream` instance into the entry
|
|
1193
|
+
*
|
|
1194
|
+
* @param readable The `ReadableStream` instance.
|
|
1195
|
+
* @param options The options.
|
|
1196
|
+
*/
|
|
1197
|
+
importReadable(readable: ReadableStream, options?: ZipReaderConstructorOptions): Promise<void>
|
|
1198
|
+
/**
|
|
1199
|
+
* Returns a `Blob` instance containing a zip file of the entry and its descendants, if any
|
|
1200
|
+
*
|
|
1201
|
+
* @param options The options.
|
|
1202
|
+
* @returns A promise resolving to the `Blob` instance.
|
|
1203
|
+
*/
|
|
1204
|
+
exportBlob(options?: ZipDirectoryEntryExportOptions): Promise<Blob>
|
|
1205
|
+
/**
|
|
1206
|
+
* Returns a Data URI `string` encoded in Base64 containing a zip file of the entry and its descendants, if any
|
|
1207
|
+
*
|
|
1208
|
+
* @param options The options.
|
|
1209
|
+
* @returns A promise resolving to the Data URI `string` encoded in Base64.
|
|
1210
|
+
*/
|
|
1211
|
+
exportData64URI(options?: ZipDirectoryEntryExportOptions): Promise<string>
|
|
1212
|
+
/**
|
|
1213
|
+
* Returns a `Uint8Array` instance containing a zip file of the entry and its descendants, if any
|
|
1214
|
+
*
|
|
1215
|
+
* @param options The options.
|
|
1216
|
+
* @returns A promise resolving to the `Uint8Array` instance.
|
|
1217
|
+
*/
|
|
1218
|
+
exportUint8Array(options?: ZipDirectoryEntryExportOptions): Promise<Uint8Array>
|
|
1219
|
+
/**
|
|
1220
|
+
* Creates a zip file via a `WritableStream` instance containing the entry and its descendants, if any
|
|
1221
|
+
*
|
|
1222
|
+
* @param writable The `WritableStream` instance.
|
|
1223
|
+
* @param options The options.
|
|
1224
|
+
* @returns A promise resolving to the `Uint8Array` instance.
|
|
1225
|
+
*/
|
|
1226
|
+
exportWritable(writable: WritableStream | void, options?: ZipDirectoryEntryExportOptions): Promise<WritableStream>
|
|
251
1227
|
}
|
|
252
1228
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
id: number;
|
|
258
|
-
parent?: ZipEntry;
|
|
259
|
-
children: ZipEntry[];
|
|
260
|
-
uncompressedSize: number;
|
|
261
|
-
getFullname(): string;
|
|
262
|
-
getRelativeName(ancestor: ZipDirectoryEntry): string;
|
|
263
|
-
isDescendantOf(ancestor: ZipDirectoryEntry): boolean;
|
|
264
|
-
}
|
|
1229
|
+
/**
|
|
1230
|
+
* Represents the options passed to `ZipDirectoryEntry#importHttpContent()`.
|
|
1231
|
+
*/
|
|
1232
|
+
interface ZipDirectoryEntryImportHttpOptions extends ZipReaderConstructorOptions, HttpOptions { }
|
|
265
1233
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
1234
|
+
/**
|
|
1235
|
+
* Represents the options passed to `ZipDirectoryEntry#export*()`.
|
|
1236
|
+
*/
|
|
1237
|
+
interface ZipDirectoryEntryExportOptions extends ZipWriterConstructorOptions, EntryDataOnprogressOptions {
|
|
1238
|
+
/**
|
|
1239
|
+
* `true` to use filenames relative to the entry instead of full filenames.
|
|
1240
|
+
*/
|
|
1241
|
+
relativePath?: boolean
|
|
270
1242
|
}
|
|
271
1243
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
1244
|
+
/**
|
|
1245
|
+
* Represents a Filesystem instance.
|
|
1246
|
+
*/
|
|
1247
|
+
export class FS extends ZipDirectoryEntry {
|
|
1248
|
+
/**
|
|
1249
|
+
* The root directory.
|
|
1250
|
+
*/
|
|
1251
|
+
root: ZipDirectoryEntry
|
|
1252
|
+
/**
|
|
1253
|
+
* Removes a `ZipEntry` instance and its children
|
|
1254
|
+
*
|
|
1255
|
+
* @param entry The `ZipEntry` instance to remove.
|
|
1256
|
+
*/
|
|
1257
|
+
remove(entry: ZipEntry): void
|
|
1258
|
+
/**
|
|
1259
|
+
* Moves a `ZipEntry` instance and its children into a `ZipDirectoryEntry` instance
|
|
1260
|
+
*
|
|
1261
|
+
* @param entry The `ZipEntry` instance to move.
|
|
1262
|
+
* @param destination The `ZipDirectoryEntry` instance.
|
|
1263
|
+
*/
|
|
1264
|
+
move(entry: ZipEntry, destination: ZipDirectoryEntry): void
|
|
1265
|
+
/**
|
|
1266
|
+
* Returns a `ZipEntry` instance from its full filename
|
|
1267
|
+
*
|
|
1268
|
+
* @param fullname The full filename.
|
|
1269
|
+
* @returns The `ZipEntry` instance.
|
|
1270
|
+
*/
|
|
1271
|
+
find(fullname: string): ZipEntry | undefined
|
|
1272
|
+
/**
|
|
1273
|
+
* Returns a `ZipEntry` instance from the value of `ZipEntry#id`
|
|
1274
|
+
*
|
|
1275
|
+
* @param id The id of the `ZipEntry` instance.
|
|
1276
|
+
* @returns The `ZipEntry` instance.
|
|
1277
|
+
*/
|
|
1278
|
+
getById(id: number): ZipEntry | undefined
|
|
287
1279
|
}
|
|
288
1280
|
|
|
289
|
-
|
|
290
|
-
|
|
1281
|
+
/**
|
|
1282
|
+
* The Filesystem API.
|
|
1283
|
+
*/
|
|
1284
|
+
export const fs: {
|
|
1285
|
+
/**
|
|
1286
|
+
* The Filesystem constructor.
|
|
1287
|
+
*
|
|
1288
|
+
* @defaultValue `FS`
|
|
1289
|
+
*/
|
|
1290
|
+
FS: typeof FS
|
|
1291
|
+
/**
|
|
1292
|
+
* The `ZipDirectoryEntry` constructor.
|
|
1293
|
+
*
|
|
1294
|
+
* @defaultValue `ZipDirectoryEntry`
|
|
1295
|
+
*/
|
|
1296
|
+
ZipDirectoryEntry: typeof ZipDirectoryEntry
|
|
1297
|
+
/**
|
|
1298
|
+
* The `ZipFileEntry` constructor.
|
|
1299
|
+
*
|
|
1300
|
+
* @defaultValue `ZipFileEntry`
|
|
1301
|
+
*/
|
|
1302
|
+
ZipFileEntry: typeof ZipFileEntry
|
|
291
1303
|
}
|
|
292
1304
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
type ZipDirectoryEntryExportOptions = EntryDataOnprogressOption & ExportOptions & ZipWriterConstructorOptions;
|
|
318
|
-
|
|
319
|
-
export class FS extends ZipDirectoryEntry {
|
|
320
|
-
constructor();
|
|
321
|
-
root: ZipDirectoryEntry;
|
|
322
|
-
remove(entry: ZipEntry): void;
|
|
323
|
-
move(entry: ZipEntry, destination: ZipDirectoryEntry): void;
|
|
324
|
-
find(fullname: string): ZipEntry;
|
|
325
|
-
getById(id: number): ZipEntry;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
export const fs: { FS: typeof FS, ZipDirectoryEntry: typeof ZipDirectoryEntry, ZipFileEntry: typeof ZipFileEntry };
|
|
329
|
-
export const ERR_HTTP_RANGE: string;
|
|
330
|
-
export const ERR_BAD_FORMAT: string;
|
|
331
|
-
export const ERR_EOCDR_NOT_FOUND: string;
|
|
332
|
-
export const ERR_EOCDR_ZIP64_NOT_FOUND: string;
|
|
333
|
-
export const ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND: string;
|
|
334
|
-
export const ERR_CENTRAL_DIRECTORY_NOT_FOUND: string;
|
|
335
|
-
export const ERR_LOCAL_FILE_HEADER_NOT_FOUND: string;
|
|
336
|
-
export const ERR_EXTRAFIELD_ZIP64_NOT_FOUND: string;
|
|
337
|
-
export const ERR_ENCRYPTED: string;
|
|
338
|
-
export const ERR_UNSUPPORTED_ENCRYPTION: string;
|
|
339
|
-
export const ERR_UNSUPPORTED_COMPRESSION: string;
|
|
340
|
-
export const ERR_INVALID_SIGNATURE: string;
|
|
341
|
-
export const ERR_INVALID_PASSWORD: string;
|
|
342
|
-
export const ERR_DUPLICATED_NAME: string;
|
|
343
|
-
export const ERR_INVALID_COMMENT: string;
|
|
344
|
-
export const ERR_INVALID_ENTRY_NAME: string;
|
|
345
|
-
export const ERR_INVALID_ENTRY_COMMENT: string;
|
|
346
|
-
export const ERR_INVALID_VERSION: string;
|
|
347
|
-
export const ERR_INVALID_EXTRAFIELD_TYPE: string;
|
|
348
|
-
export const ERR_INVALID_EXTRAFIELD_DATA: string;
|
|
349
|
-
export const ERR_INVALID_ENCRYPTION_STRENGTH: string;
|
|
350
|
-
export const ERR_UNSUPPORTED_FORMAT: string;
|
|
1305
|
+
// The error messages.
|
|
1306
|
+
export const ERR_HTTP_RANGE: string
|
|
1307
|
+
export const ERR_BAD_FORMAT: string
|
|
1308
|
+
export const ERR_EOCDR_NOT_FOUND: string
|
|
1309
|
+
export const ERR_EOCDR_ZIP64_NOT_FOUND: string
|
|
1310
|
+
export const ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND: string
|
|
1311
|
+
export const ERR_CENTRAL_DIRECTORY_NOT_FOUND: string
|
|
1312
|
+
export const ERR_LOCAL_FILE_HEADER_NOT_FOUND: string
|
|
1313
|
+
export const ERR_EXTRAFIELD_ZIP64_NOT_FOUND: string
|
|
1314
|
+
export const ERR_ENCRYPTED: string
|
|
1315
|
+
export const ERR_UNSUPPORTED_ENCRYPTION: string
|
|
1316
|
+
export const ERR_UNSUPPORTED_COMPRESSION: string
|
|
1317
|
+
export const ERR_INVALID_SIGNATURE: string
|
|
1318
|
+
export const ERR_INVALID_PASSWORD: string
|
|
1319
|
+
export const ERR_DUPLICATED_NAME: string
|
|
1320
|
+
export const ERR_INVALID_COMMENT: string
|
|
1321
|
+
export const ERR_INVALID_ENTRY_NAME: string
|
|
1322
|
+
export const ERR_INVALID_ENTRY_COMMENT: string
|
|
1323
|
+
export const ERR_INVALID_VERSION: string
|
|
1324
|
+
export const ERR_INVALID_EXTRAFIELD_TYPE: string
|
|
1325
|
+
export const ERR_INVALID_EXTRAFIELD_DATA: string
|
|
1326
|
+
export const ERR_INVALID_ENCRYPTION_STRENGTH: string
|
|
1327
|
+
export const ERR_UNSUPPORTED_FORMAT: string
|