@@ -50,6 +50,8 @@ export type BrotliCompress = any;
50
50
51
51
export type BrotliDecompress = any ;
52
52
53
+ export type BufferLike = any ;
54
+
53
55
/**
54
56
* Creates a writable stream which compresses data using the DEFLATE algorithm.
55
57
*
@@ -73,7 +75,7 @@ export function createInflate(options?: any): Inflate {
73
75
/**
74
76
* Creates a writable stream which compresses data using the Brotli algorithm.
75
77
*
76
- * @param options Zlib options to apply to this stream. Optional.
78
+ * @param options Brotli options to apply to this stream. Optional.
77
79
* @returns Deflation stream
78
80
*/
79
81
export function createBrotliCompress ( options ?: any ) : Deflate {
@@ -83,13 +85,30 @@ export function createBrotliCompress(options?: any): Deflate {
83
85
/**
84
86
* Creates a readable stream which decompresses data using the Brotli algorithm.
85
87
*
86
- * @param options Zlib options to apply to this stream. Optional.
88
+ * @param options Brotli options to apply to this stream. Optional.
87
89
* @returns Inflation stream
88
90
*/
89
91
export function createBrotliDecompress ( options ?: any ) : Inflate {
90
92
return intrinsic ( ) . createBrotliDecompress ( options ) ;
91
93
}
92
94
95
+ /**
96
+ * Asynchronously compresses the given data using the DEFLATE algorithm.
97
+ *
98
+ * @param data The data to compress
99
+ * @param options Zlib options to apply to this compression. Optional.
100
+ * @returns The compressed data
101
+ */
102
+ export function deflate (
103
+ data : string | Buffer | DataView | any ,
104
+ optionsOrCbk ?: any ,
105
+ cbk ?: ( errOrResult : Error | BufferLike ) => void ,
106
+ ) : Buffer {
107
+ const callback = cbk || optionsOrCbk ;
108
+ const opts = cbk ? optionsOrCbk : undefined ;
109
+ return intrinsic ( ) . deflate ( data , opts , callback ) ;
110
+ }
111
+
93
112
/**
94
113
* Synchronously compresses the given data using the DEFLATE algorithm.
95
114
*
@@ -101,6 +120,23 @@ export function deflateSync(data: string | Buffer | DataView | any, options?: an
101
120
return intrinsic ( ) . deflateSync ( data , options ) ;
102
121
}
103
122
123
+ /**
124
+ * Asynchronously decompresses the given data using the DEFLATE algorithm.
125
+ *
126
+ * @param data The data to decompress
127
+ * @param options Zlib options to apply to this compression. Optional.
128
+ * @returns The decompressed data
129
+ */
130
+ export function inflate (
131
+ data : string | Buffer | DataView | any ,
132
+ optionsOrCbk ?: any ,
133
+ cbk ?: ( errOrResult : Error | BufferLike ) => void ,
134
+ ) : Buffer {
135
+ const callback = cbk || optionsOrCbk ;
136
+ const opts = cbk ? optionsOrCbk : undefined ;
137
+ return intrinsic ( ) . inflate ( data , opts , callback ) ;
138
+ }
139
+
104
140
/**
105
141
* Synchronously decompresses the given data using the DEFLATE algorithm.
106
142
*
@@ -145,22 +181,56 @@ export function unzipSync(data: string | Buffer | DataView | any, options?: any)
145
181
return intrinsic ( ) . unzipSync ( data , options ) ;
146
182
}
147
183
184
+ /**
185
+ * Asynchronously compresses the given data using the Brotli algorithm.
186
+ *
187
+ * @param data The data to compress
188
+ * @param options Brotli options to apply to this compression. Optional.
189
+ * @returns The compressed data
190
+ */
191
+ export function brotliCompress (
192
+ data : string | Buffer | DataView | any ,
193
+ optionsOrCbk ?: any ,
194
+ cbk ?: ( errOrResult : Error | BufferLike ) => void ,
195
+ ) : Buffer {
196
+ const callback = cbk || optionsOrCbk ;
197
+ const opts = cbk ? optionsOrCbk : undefined ;
198
+ return intrinsic ( ) . brotliCompress ( data , opts , callback ) ;
199
+ }
200
+
148
201
/**
149
202
* Synchronously compresses the given data using the Brotli algorithm.
150
203
*
151
204
* @param data The data to compress
152
- * @param options Zlib options to apply to this compression. Optional.
205
+ * @param options Brotli options to apply to this compression. Optional.
153
206
* @returns The compressed data
154
207
*/
155
208
export function brotliCompressSync ( data : string | Buffer | DataView | any , options ?: any ) : Buffer {
156
209
return intrinsic ( ) . brotliCompressSync ( data , options ) ;
157
210
}
158
211
212
+ /**
213
+ * Asynchronously decompresses the given data using the Brotli algorithm.
214
+ *
215
+ * @param data The data to decompress
216
+ * @param options Brotli options to apply to this compression. Optional.
217
+ * @returns The decompressed data
218
+ */
219
+ export function brotliDecompress (
220
+ data : string | Buffer | DataView | any ,
221
+ optionsOrCbk ?: any ,
222
+ cbk ?: ( errOrResult : Error | BufferLike ) => void ,
223
+ ) : Buffer {
224
+ const callback = cbk || optionsOrCbk ;
225
+ const opts = cbk ? optionsOrCbk : undefined ;
226
+ return intrinsic ( ) . brotliDecompress ( data , opts , callback ) ;
227
+ }
228
+
159
229
/**
160
230
* Synchronously decompresses the given data using the Brotli algorithm.
161
231
*
162
232
* @param data The data to decompress
163
- * @param options Zlib options to apply to this decompression. Optional.
233
+ * @param options Brotli options to apply to this decompression. Optional.
164
234
* @returns The decompressed data
165
235
*/
166
236
export function brotliDecompressSync ( data : string | Buffer | DataView | any , options ?: any ) : Buffer {
0 commit comments