@@ -50,6 +50,8 @@ export type BrotliCompress = any;
5050
5151export type BrotliDecompress = any ;
5252
53+ export type BufferLike = any ;
54+
5355/**
5456 * Creates a writable stream which compresses data using the DEFLATE algorithm.
5557 *
@@ -73,7 +75,7 @@ export function createInflate(options?: any): Inflate {
7375/**
7476 * Creates a writable stream which compresses data using the Brotli algorithm.
7577 *
76- * @param options Zlib options to apply to this stream. Optional.
78+ * @param options Brotli options to apply to this stream. Optional.
7779 * @returns Deflation stream
7880 */
7981export function createBrotliCompress ( options ?: any ) : Deflate {
@@ -83,13 +85,30 @@ export function createBrotliCompress(options?: any): Deflate {
8385/**
8486 * Creates a readable stream which decompresses data using the Brotli algorithm.
8587 *
86- * @param options Zlib options to apply to this stream. Optional.
88+ * @param options Brotli options to apply to this stream. Optional.
8789 * @returns Inflation stream
8890 */
8991export function createBrotliDecompress ( options ?: any ) : Inflate {
9092 return intrinsic ( ) . createBrotliDecompress ( options ) ;
9193}
9294
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+
93112/**
94113 * Synchronously compresses the given data using the DEFLATE algorithm.
95114 *
@@ -101,6 +120,23 @@ export function deflateSync(data: string | Buffer | DataView | any, options?: an
101120 return intrinsic ( ) . deflateSync ( data , options ) ;
102121}
103122
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+
104140/**
105141 * Synchronously decompresses the given data using the DEFLATE algorithm.
106142 *
@@ -145,22 +181,56 @@ export function unzipSync(data: string | Buffer | DataView | any, options?: any)
145181 return intrinsic ( ) . unzipSync ( data , options ) ;
146182}
147183
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+
148201/**
149202 * Synchronously compresses the given data using the Brotli algorithm.
150203 *
151204 * @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.
153206 * @returns The compressed data
154207 */
155208export function brotliCompressSync ( data : string | Buffer | DataView | any , options ?: any ) : Buffer {
156209 return intrinsic ( ) . brotliCompressSync ( data , options ) ;
157210}
158211
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+
159229/**
160230 * Synchronously decompresses the given data using the Brotli algorithm.
161231 *
162232 * @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.
164234 * @returns The decompressed data
165235 */
166236export function brotliDecompressSync ( data : string | Buffer | DataView | any , options ?: any ) : Buffer {
0 commit comments