Base64 Zip Processor icon

Base64 Zip Processor

Compress or extract zip files

Actions2

Overview

This node processes files in base64 format to either compress them into a password-protected or unprotected ZIP archive or extract files from a ZIP archive. It supports both zipping and unzipping operations with optional AES-256 encryption.

Common scenarios include:

  • Compressing one or more files into a single ZIP archive for easier storage or transfer.
  • Encrypting ZIP archives with a password for secure file sharing.
  • Extracting files from ZIP archives, including those protected by a password.

Practical examples:

  • Automating backup of data by compressing files before uploading to cloud storage.
  • Receiving encrypted ZIP files via email and automatically extracting their contents.
  • Creating password-protected ZIP files to securely send sensitive documents.

Properties

Name Meaning
File Buffer The input file content encoded as a base64 string. For zipping, this is the raw file; for unzipping, this is the ZIP archive.
File Name (Only for zip operation) The desired name of the output ZIP file (without extension).
Password Optional password used to encrypt the ZIP archive when zipping, or to decrypt when unzipping.

Output

The node outputs data in the following structure depending on the operation:

  • Zip operation: Outputs a binary file named as specified (with .zip extension), containing the compressed (and optionally encrypted) ZIP archive. The binary data includes:

    • mimeType: Always "application/zip".
    • fileName: The ZIP file name with .zip extension.
    • data: The ZIP archive content encoded as a base64 string.
  • Unzip operation: Outputs a JSON object with a files array. Each element in the array represents an extracted file with:

    • name: The original filename inside the ZIP archive.
    • data: The file content encoded as a base64 string.

Dependencies

  • Uses the archiver and archiver-zip-encrypted libraries for creating ZIP archives with optional AES-256 encryption.
  • Uses the @zip.js/zip.js library for reading and extracting ZIP archives, supporting encrypted entries.
  • Requires Node.js Buffer API for handling binary data.
  • No external API keys or services are required.
  • No special n8n environment variables needed beyond standard node execution context.

Troubleshooting

  • Error: "Entry 'filename' is password protected"
    Occurs when trying to unzip a password-protected archive without providing the correct password.
    Resolution: Provide the correct password in the Password property.

  • Invalid operation error
    Happens if the operation parameter is set to a value other than "zip" or "unzip".
    Resolution: Ensure the operation property is correctly set to either "zip" or "unzip".

  • Corrupted or invalid base64 input
    If the input file buffer is not valid base64 or does not represent a proper file/archive, errors may occur during processing.
    Resolution: Verify that the input file buffer is correctly base64 encoded and corresponds to the expected file type.

  • Password issues
    Using an incorrect password for encryption or decryption will cause failures.
    Resolution: Double-check the password entered matches the intended encryption/decryption key.

Links and References

Discussion