( filePath: string, )
| 209 | * Returns its contents as a record of file paths to Uint8Array data. |
| 210 | */ |
| 211 | export async function readAndUnzipFile( |
| 212 | filePath: string, |
| 213 | ): Promise<Record<string, Uint8Array>> { |
| 214 | const fs = getFsImplementation() |
| 215 | |
| 216 | try { |
| 217 | const zipData = await fs.readFileBytes(filePath) |
| 218 | // await is required here: without it, rejections from the now-async |
| 219 | // unzipFile() escape the try/catch and bypass the error wrapping below. |
| 220 | return await unzipFile(zipData) |
| 221 | } catch (error) { |
| 222 | if (isENOENT(error)) { |
| 223 | throw error |
| 224 | } |
| 225 | const errorMessage = error instanceof Error ? error.message : String(error) |
| 226 | throw new Error(`Failed to read or unzip file: ${errorMessage}`) |
| 227 | } |
| 228 | } |
nothing calls this directly
no test coverage detected