File tree Expand file tree Collapse file tree 1 file changed +4
-35
lines changed
extensions/ql-vscode/src/common Expand file tree Collapse file tree 1 file changed +4
-35
lines changed Original file line number Diff line number Diff line change 1- import { gzip , gunzip , InputType as ZlibInputType , ZlibOptions } from "zlib" ;
1+ import { promisify } from "util" ;
2+ import { gzip , gunzip } from "zlib" ;
23
34/**
45 * Promisified version of zlib.gzip
5- * @param buffer Buffer to compress
6- * @param options zlib options
76 */
8- export function gzipEncode (
9- buffer : ZlibInputType ,
10- options : ZlibOptions = { } ,
11- ) : Promise < Buffer > {
12- return new Promise ( ( resolve , reject ) => {
13- gzip ( buffer , options , ( error , result ) => {
14- if ( error ) {
15- reject ( error ) ;
16- return ;
17- }
18-
19- resolve ( result ) ;
20- } ) ;
21- } ) ;
22- }
7+ export const gzipEncode = promisify ( gzip ) ;
238
249/**
2510 * Promisified version of zlib.gunzip
26- * @param buffer Buffer to decompress
27- * @param options zlib options
2811 */
29- export function gzipDecode (
30- buffer : ZlibInputType ,
31- options : ZlibOptions = { } ,
32- ) : Promise < Buffer > {
33- return new Promise ( ( resolve , reject ) => {
34- gunzip ( buffer , options , ( error , result ) => {
35- if ( error ) {
36- reject ( error ) ;
37- return ;
38- }
39-
40- resolve ( result ) ;
41- } ) ;
42- } ) ;
43- }
12+ export const gzipDecode = promisify ( gunzip ) ;
You can’t perform that action at this time.
0 commit comments