MCPcopy Index your code
hub / github.com/codeaashu/claude-code / readAndUnzipFile

Function readAndUnzipFile

src/utils/dxt/zip.ts:209–226  ·  view source on GitHub ↗
(
  filePath: string,
)

Source from the content-addressed store, hash-verified

207 * Returns its contents as a record of file paths to Uint8Array data.
208 */
209export 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

Callers

nothing calls this directly

Calls 3

getFsImplementationFunction · 0.85
unzipFileFunction · 0.85
isENOENTFunction · 0.85

Tested by

no test coverage detected