Base64 Zip Processor icon

Base64 Zip Processor

Compress or extract zip files

Actions2

Overview

This node processes ZIP files encoded in base64 format, allowing users to either compress data into a ZIP archive or extract files from an existing ZIP archive. It supports password-based encryption and decryption using AES-256, making it useful for securely handling compressed files within workflows.

Common scenarios include:

  • Compressing multiple files or data streams into a single encrypted ZIP file for secure storage or transfer.
  • Extracting files from password-protected ZIP archives received from external sources.
  • Automating backup and archival processes where compression and encryption are required.

For example, you can input a base64-encoded buffer of a file to be zipped with a password, producing a base64-encoded encrypted ZIP file as output. Conversely, you can input a base64-encoded encrypted ZIP file along with the password to extract its contents as individual base64-encoded files.

Properties

Name Meaning
File Buffer The base64-encoded string representing the file content to be zipped or unzipped.
Password Optional password used for encrypting (when zipping) or decrypting (when unzipping) files.

Output

  • For the Unzip operation, the output JSON contains a files array. Each element represents a file extracted from the ZIP archive with the following structure:
    • name: The filename inside the ZIP archive.
    • data: The file content encoded as a base64 string.

Example output JSON snippet:

{
  "files": [
    {
      "name": "example.txt",
      "data": "base64-encoded-content"
    },
    {
      "name": "image.png",
      "data": "base64-encoded-content"
    }
  ]
}
  • For the Zip operation (not requested here), the output includes a binary field containing the zipped file as a base64-encoded string with MIME type application/zip.

Dependencies

  • Uses the @zip.js/zip.js library for reading and extracting ZIP files, including support for encrypted entries.
  • Uses the archiver and archiver-zip-encrypted libraries for creating ZIP archives with optional AES-256 encryption.
  • Requires Node.js Buffer API for base64 encoding and decoding.
  • No explicit external API keys or credentials are needed; however, proper configuration of the node parameters is essential.

Troubleshooting

  • Password Protected Entry Without Password: If attempting to unzip a password-protected archive without providing the correct password, the node throws an error indicating that the entry is password protected. To resolve, provide the correct password in the Password property.
  • Invalid Operation: If an unsupported operation is specified, the node will throw an "Invalid operation" error. Ensure the operation parameter is set correctly to either "zip" or "unzip".
  • Malformed Base64 Input: Providing an invalid base64 string in the File Buffer property may cause decoding errors. Verify that the input is properly base64-encoded.
  • Large Files: Processing very large ZIP files might lead to performance issues or memory exhaustion depending on the environment.

Links and References

Discussion