@@ -12,9 +12,12 @@ interface Chunk {
12
12
}
13
13
14
14
// browserify-zlib, which is the zlib shim used by default in webpacked code,
15
- // does not properly uncompress bgzf chunks that contain more than
16
- // one bgzf block, so export an unzip function that uses pako directly
17
- // if we are running in a browser.
15
+ // does not properly uncompress bgzf chunks that contain more than one bgzf
16
+ // block, so export an unzip function that uses pako directly if we are running
17
+ // in a browser.
18
+ //
19
+ //
20
+ // eslint-disable-next-line @typescript-eslint/require-await
18
21
async function unzip ( inputData : Buffer ) {
19
22
try {
20
23
let strm
@@ -28,15 +31,18 @@ async function unzip(inputData: Buffer) {
28
31
inflator = new Inflate ( )
29
32
//@ts -ignore
30
33
; ( { strm } = inflator )
34
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
31
35
inflator . push ( remainingInput , Z_SYNC_FLUSH )
32
36
if ( inflator . err ) {
33
37
throw new Error ( inflator . msg )
34
38
}
35
39
40
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
36
41
pos += strm . next_in
37
42
chunks [ i ] = inflator . result as Uint8Array
38
43
totalSize += chunks [ i ] . length
39
44
i += 1
45
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
40
46
} while ( strm . avail_in )
41
47
42
48
const result = new Uint8Array ( totalSize )
@@ -45,20 +51,21 @@ async function unzip(inputData: Buffer) {
45
51
offset += chunks [ i ] . length
46
52
}
47
53
return Buffer . from ( result )
48
- } catch ( e ) {
54
+ } catch ( error ) {
49
55
//cleanup error message
50
- if ( ` ${ e } ` . match ( / i n c o r r e c t h e a d e r c h e c k / ) ) {
56
+ if ( / i n c o r r e c t h e a d e r c h e c k / . test ( ` ${ error } ` ) ) {
51
57
throw new Error (
52
58
'problem decompressing block: incorrect gzip header check' ,
53
59
)
54
60
}
55
- throw e
61
+ throw error
56
62
}
57
63
}
58
64
59
- // similar to pakounzip, except it does extra counting
60
- // to return the positions of compressed and decompressed
61
- // data offsets
65
+ // similar to pakounzip, except it does extra counting to return the positions
66
+ // of compressed and decompressed data offsets
67
+ //
68
+ // eslint-disable-next-line @typescript-eslint/require-await
62
69
async function unzipChunk ( inputData : Buffer ) {
63
70
try {
64
71
let strm
@@ -72,6 +79,7 @@ async function unzipChunk(inputData: Buffer) {
72
79
const inflator = new Inflate ( )
73
80
// @ts -ignore
74
81
; ( { strm } = inflator )
82
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
75
83
inflator . push ( remainingInput , Z_SYNC_FLUSH )
76
84
if ( inflator . err ) {
77
85
throw new Error ( inflator . msg )
@@ -83,25 +91,29 @@ async function unzipChunk(inputData: Buffer) {
83
91
cpositions . push ( cpos )
84
92
dpositions . push ( dpos )
85
93
94
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
86
95
cpos += strm . next_in
87
96
dpos += buffer . length
97
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
88
98
} while ( strm . avail_in )
89
99
90
100
const buffer = Buffer . concat ( blocks )
91
101
return { buffer, cpositions, dpositions }
92
- } catch ( e ) {
102
+ } catch ( error ) {
93
103
//cleanup error message
94
- if ( ` ${ e } ` . match ( / i n c o r r e c t h e a d e r c h e c k / ) ) {
104
+ if ( / i n c o r r e c t h e a d e r c h e c k / . test ( ` ${ error } ` ) ) {
95
105
throw new Error (
96
106
'problem decompressing block: incorrect gzip header check' ,
97
107
)
98
108
}
99
- throw e
109
+ throw error
100
110
}
101
111
}
102
112
103
113
// similar to unzipChunk above but slices (0,minv.dataPosition) and
104
114
// (maxv.dataPosition,end) off
115
+ //
116
+ // eslint-disable-next-line @typescript-eslint/require-await
105
117
async function unzipChunkSlice ( inputData : Buffer , chunk : Chunk ) {
106
118
try {
107
119
let strm
@@ -119,6 +131,7 @@ async function unzipChunkSlice(inputData: Buffer, chunk: Chunk) {
119
131
const inflator = new Inflate ( )
120
132
// @ts -ignore
121
133
; ( { strm } = inflator )
134
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
122
135
inflator . push ( remainingInput , Z_SYNC_FLUSH )
123
136
if ( inflator . err ) {
124
137
throw new Error ( inflator . msg )
@@ -136,6 +149,7 @@ async function unzipChunkSlice(inputData: Buffer, chunk: Chunk) {
136
149
len = chunks [ 0 ] . length
137
150
}
138
151
const origCpos = cpos
152
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
139
153
cpos += strm . next_in
140
154
dpos += len
141
155
@@ -158,6 +172,7 @@ async function unzipChunkSlice(inputData: Buffer, chunk: Chunk) {
158
172
}
159
173
totalSize += chunks [ i ] . length
160
174
i ++
175
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
161
176
} while ( strm . avail_in )
162
177
163
178
const result = new Uint8Array ( totalSize )
@@ -168,14 +183,14 @@ async function unzipChunkSlice(inputData: Buffer, chunk: Chunk) {
168
183
const buffer = Buffer . from ( result )
169
184
170
185
return { buffer, cpositions, dpositions }
171
- } catch ( e ) {
186
+ } catch ( error ) {
172
187
//cleanup error message
173
- if ( ` ${ e } ` . match ( / i n c o r r e c t h e a d e r c h e c k / ) ) {
188
+ if ( / i n c o r r e c t h e a d e r c h e c k / . test ( ` ${ error } ` ) ) {
174
189
throw new Error (
175
190
'problem decompressing block: incorrect gzip header check' ,
176
191
)
177
192
}
178
- throw e
193
+ throw error
179
194
}
180
195
}
181
196
0 commit comments