Skip to content

Commit 3b66788

Browse files
committed
feat(zlib): implement brotli methods
Signed-off-by: Sam Gammon <sam@elide.dev>
1 parent 4310913 commit 3b66788

File tree

1 file changed

+57
-0
lines changed
  • elide/runtime/js/modules/zlib

1 file changed

+57
-0
lines changed

elide/runtime/js/modules/zlib/zlib.ts

+57
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export type Deflate = any;
4646

4747
export type Inflate = any;
4848

49+
export type BrotliCompress = any;
50+
51+
export type BrotliDecompress = any;
52+
4953
/**
5054
* Creates a writable stream which compresses data using the DEFLATE algorithm.
5155
*
@@ -66,6 +70,26 @@ export function createInflate(options?: any): Inflate {
6670
return intrinsic().createInflate(options);
6771
}
6872

73+
/**
74+
* Creates a writable stream which compresses data using the Brotli algorithm.
75+
*
76+
* @param options Zlib options to apply to this stream. Optional.
77+
* @returns Deflation stream
78+
*/
79+
export function createBrotliCompress(options?: any): Deflate {
80+
return intrinsic().createBrotliCompress(options);
81+
}
82+
83+
/**
84+
* Creates a readable stream which decompresses data using the Brotli algorithm.
85+
*
86+
* @param options Zlib options to apply to this stream. Optional.
87+
* @returns Inflation stream
88+
*/
89+
export function createBrotliDecompress(options?: any): Inflate {
90+
return intrinsic().createBrotliDecompress(options);
91+
}
92+
6993
/**
7094
* Synchronously compresses the given data using the DEFLATE algorithm.
7195
*
@@ -109,3 +133,36 @@ export function gzipSync(data: string | Buffer | DataView | any, options?: any):
109133
export function gunzipSync(data: string | Buffer | DataView | any, options?: any): Buffer {
110134
return intrinsic().gunzipSync(data, options);
111135
}
136+
137+
/**
138+
* Synchronously decompresses the given data using the zip algorithm.
139+
*
140+
* @param data The data to decompress
141+
* @param options Zlib options to apply to this decompression. Optional.
142+
* @returns The decompressed data
143+
*/
144+
export function unzipSync(data: string | Buffer | DataView | any, options?: any): Buffer {
145+
return intrinsic().unzipSync(data, options);
146+
}
147+
148+
/**
149+
* Synchronously compresses the given data using the Brotli algorithm.
150+
*
151+
* @param data The data to compress
152+
* @param options Zlib options to apply to this compression. Optional.
153+
* @returns The compressed data
154+
*/
155+
export function brotliCompressSync(data: string | Buffer | DataView | any, options?: any): Buffer {
156+
return intrinsic().brotliCompressSync(data, options);
157+
}
158+
159+
/**
160+
* Synchronously decompresses the given data using the Brotli algorithm.
161+
*
162+
* @param data The data to decompress
163+
* @param options Zlib options to apply to this decompression. Optional.
164+
* @returns The decompressed data
165+
*/
166+
export function brotliDecompressSync(data: string | Buffer | DataView | any, options?: any): Buffer {
167+
return intrinsic().brotliDecompressSync(data, options);
168+
}

0 commit comments

Comments
 (0)