decompress
Extract ZIP file contents to a specified directory with options for password-protected archives, overwriting files, and creating output directories.
Instructions
Decompress local ZIP file to specified directory
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes | ZIP file path to decompress | |
| output | Yes | Output directory path | |
| options | No |
Implementation Reference
- src/index.ts:227-267 (handler)Handler logic for the "decompress" tool using AdmZip to extract ZIP files.
case "decompress": { const input = args.input as string; const output = args.output as string; const options = (args.options as any) || {}; if (!fs.existsSync(input)) { throw new Error(`ZIP file does not exist: ${input}`); } if (options.createDirectories && !fs.existsSync(output)) { fs.mkdirSync(output, { recursive: true }); } if (!fs.existsSync(output)) { throw new Error(`Output directory does not exist: ${output}`); } const zip = new AdmZip(input); zip.extractAllTo(output, options.overwrite || false); const entries = zip.getEntries(); return { content: [ { type: "text", text: JSON.stringify( { success: true, output: output, filesExtracted: entries.length, files: entries.map((e) => e.entryName), }, null, 2, ), }, ], }; } - src/index.ts:78-111 (schema)Schema definition for the "decompress" tool in the listTools request handler.
name: "decompress", description: "Decompress local ZIP file to specified directory", inputSchema: { type: "object", properties: { input: { type: "string", description: "ZIP file path to decompress", }, output: { type: "string", description: "Output directory path", }, options: { type: "object", properties: { overwrite: { type: "boolean", description: "Overwrite existing files", }, password: { type: "string", description: "Password for encrypted ZIP", }, createDirectories: { type: "boolean", description: "Create output directory if it doesn't exist", }, }, }, }, required: ["input", "output"], }, },