Skip to main content
Glama

mcp-google-sheets

unzip-file.ts1.49 kB
import { Property, createAction } from '@activepieces/pieces-framework'; import AdmZip from 'adm-zip'; interface Result { file: string; filePath: string; } const maxResultsDescription = ` Throw an error if zip file has more than expected entries. - This is a safe measure when working with untrusted zip files. - Exclude this field or set to 0 to skip this check. `; export const unzipFile = createAction({ name: 'unzipFile', displayName: 'Unzip File', description: 'Unzip compressed zip file', props: { file: Property.File({ displayName: 'Zip File', required: true, }), maxResults: Property.Number({ displayName: 'Max Results', description: maxResultsDescription, defaultValue: 0, required: false, }), }, async run(context) { const zipFile = new AdmZip(context.propsValue.file.data); const maxResults = context.propsValue.maxResults || 0; if (maxResults !== 0 && zipFile.getEntryCount() > maxResults) { throw `Zip file contains more entries than allowed: ${zipFile.getEntryCount()}`; } const results: Result[] = []; zipFile.forEach(async (zipEntry) => { if (!zipEntry.isDirectory) { const fileReference = await context.files.write({ data: zipEntry.getData(), fileName: zipEntry.name, }); results.push({ file: fileReference, filePath: zipEntry.entryName, }); } }); return results; }, });

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/activepieces/activepieces'

If you have feedback or need assistance with the MCP directory API, please join our Discord server