MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / unzipFile

Function unzipFile

source code/utils/dxt/zip.ts:115–143  ·  view source on GitHub ↗
(
  zipData: Buffer,
)

Source from the content-addressed store, hash-verified

113 * when this module is reached via the plugin loader chain.
114 */
115export async function unzipFile(
116 zipData: Buffer,
117): Promise<Record<string, Uint8Array>> {
118 const { unzipSync } = await import('fflate')
119 const compressedSize = zipData.length
120
121 const state: ZipValidationState = {
122 fileCount: 0,
123 totalUncompressedSize: 0,
124 compressedSize: compressedSize,
125 errors: [],
126 }
127
128 const result = unzipSync(new Uint8Array(zipData), {
129 filter: file => {
130 const validationResult = validateZipFile(file, state)
131 if (!validationResult.isValid) {
132 throw new Error(validationResult.error!)
133 }
134 return true
135 },
136 })
137
138 logForDebugging(
139 `Zip extraction completed: ${state.fileCount} files, ${Math.round(state.totalUncompressedSize / 1024)}KB uncompressed`,
140 )
141
142 return result
143}
144
145/**
146 * Parse Unix file modes from a zip's central directory.

Callers 4

readAndUnzipFileFunction · 0.85
extractZipToDirectoryFunction · 0.85
loadMcpbFileFunction · 0.85

Calls 2

validateZipFileFunction · 0.85
logForDebuggingFunction · 0.85

Tested by

no test coverage detected