()
| 322 | } |
| 323 | |
| 324 | private async open(): Promise<void> { |
| 325 | this.zipFile = await new Promise<yauzl.ZipFile>((resolve, reject) => { |
| 326 | yauzl.open(this.fileName, { lazyEntries: true, autoClose: false }, (error, zipFile) => { |
| 327 | if (error || !zipFile) { |
| 328 | reject(error || new Error(`Cannot open zip: ${this.fileName}`)) |
| 329 | return |
| 330 | } |
| 331 | resolve(zipFile) |
| 332 | }) |
| 333 | }) |
| 334 | |
| 335 | await new Promise<void>((resolve, reject) => { |
| 336 | this.zipFile!.readEntry() |
| 337 | this.zipFile!.on('entry', (entry) => { |
| 338 | this.entriesMap.set(entry.fileName, entry) |
| 339 | this.zipFile!.readEntry() |
| 340 | }) |
| 341 | this.zipFile!.on('end', resolve) |
| 342 | this.zipFile!.on('error', reject) |
| 343 | }) |
| 344 | } |
| 345 | |
| 346 | async entries(): Promise<string[]> { |
| 347 | await this.openedPromise |
no test coverage detected