Skip to content

Commit 6b3b5fd

Browse files
committed
Extract CompressionOptions to interface
1 parent c837a4b commit 6b3b5fd

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

index.d.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ interface JSZipSupport {
1515

1616
type Compression = 'STORE' | 'DEFLATE';
1717

18+
/**
19+
* Depends on the compression type. With `STORE` (no compression), these options are ignored. With
20+
* `DEFLATE`, you can give the compression level between 1 (best speed) and 9 (best compression).
21+
*/
22+
interface CompressionOptions {
23+
level: number;
24+
}
25+
1826
interface Metadata {
1927
percent: number;
2028
currentFile: string;
@@ -106,11 +114,9 @@ declare namespace JSZip {
106114
*/
107115
compression?: Compression;
108116
/**
109-
* Sets per file compression level. With `STORE` (no compression), this parameter is ignored. With `DEFLATE`, you can give the compression level with `compressionOptions : {level:6}` (or any level between 1 (best speed) and 9 (best compression)).
117+
* Sets per file compression level for `DEFLATE` compression.
110118
*/
111-
compressionOptions?: null | {
112-
level: number;
113-
};
119+
compressionOptions?: null | CompressionOptions;
114120
comment?: string;
115121
/** Set to `true` if (and only if) the input is a "binary string" and has already been prepared with a `0xFF` mask. */
116122
optimizedBinaryString?: boolean;
@@ -138,11 +144,9 @@ declare namespace JSZip {
138144
*/
139145
compression?: Compression;
140146
/**
141-
* The `compressionOptions` parameter depends on the compression type. With `STORE` (no compression), this parameter is ignored. With `DEFLATE`, you can give the compression level with `compressionOptions : {level:6}` (or any level between 1 (best speed) and 9 (best compression)).
147+
* Sets compression level for `DEFLATE` compression.
142148
*/
143-
compressionOptions?: null | {
144-
level: number;
145-
};
149+
compressionOptions?: null | CompressionOptions;
146150
type?: T;
147151
comment?: string;
148152
/**

0 commit comments

Comments
 (0)