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