forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zip.js.d.ts
94 lines (75 loc) · 2.79 KB
/
zip.js.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Type definitions for zip.js 2.x
// Project: https://github.com/gildas-lormeau/zip.js
// Definitions by: Louis Grignon <https://github.com/lgrignon>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface FileEntry {}
declare module zip {
export var useWebWorkers: boolean;
export var workerScriptsPath: string;
export var workerScripts: {
deflater?: string[];
inflater?: string[];
};
export class Reader {
public size: number;
public init(callback: () => void, onerror: (error: any) => void): void;
public readUint8Array(index: number, length: number, callback: (result: Uint8Array) => void, onerror?: (error: any) => void): void;
}
export class TextReader extends Reader {
constructor(text: string);
}
export class BlobReader extends Reader {
constructor(blob: Blob);
}
export class Data64URIReader extends Reader {
constructor(dataURI: string);
}
export class HttpReader extends Reader {
constructor(url: string);
}
export function createReader(reader: zip.Reader, callback: (zipReader: ZipReader) => void, onerror?: (error: any) => void): void;
export class ZipReader {
getEntries(callback: (entries: zip.Entry[]) => void): void;
close(callback?: () => void): void;
}
export interface Entry {
filename: string;
directory: boolean;
compressedSize: number;
uncompressedSize: number;
lastModDate: Date;
lastModDateRaw: number;
comment: string;
crc32: number;
getData(writer: zip.Writer, onend: (result: any) => void, onprogress?: (progress: number, total: number) => void, checkCrc32?: boolean): void;
}
export class Writer {
public init(callback: () => void, onerror?: (error: any) => void): void;
public writeUint8Array(array: Uint8Array, callback: () => void, onerror?: (error: any) => void): void;
public getData(callback: (data: any) => void, onerror?: (error: any) => void) : void;
}
export class TextWriter extends Writer {
constructor(encoding: string);
}
export class BlobWriter extends Writer {
constructor(contentType: string);
}
export class FileWriter extends Writer {
constructor(fileEntry: FileEntry);
}
export class Data64URIWriter extends Writer {
constructor(mimeString?: string);
}
export function createWriter(writer: zip.Writer, callback: (zipWriter: zip.ZipWriter) => void, onerror?: (error: any) => void, dontDeflate?: boolean): void;
export interface WriteOptions {
directory?: boolean;
level?: number;
comment?: string;
lastModDate?: Date;
version?: number;
}
export class ZipWriter {
public add(name: string, reader: zip.Reader, onend: () => void, onprogress?: (progress: number, total: number) => void, options?: WriteOptions): void;
public close(callback: (result: any) => void): void;
}
}