Pako Compress

Nén hoặc giải nén dữ liệu bằng thư viện pako

Pako Compress

AI-generated

Overview

This node compresses or decompresses data using the pako library, which is a JavaScript implementation of zlib. It is useful for scenarios where you need to reduce the size of JSON or text data for storage or transmission, or to decompress previously compressed data. For example, you can compress a JSON object into a base64url string for embedding in URLs or decompress such strings back into JSON objects.

Use Case Examples

  1. Compress a JSON string to a base64url encoded compressed string for URL embedding.
  2. Decompress a base64url encoded compressed string back to the original JSON object.

Properties

Name Meaning
Action Determines whether to compress or decompress the input data.
Input Data The JSON string or text to be compressed or decompressed.

Output

JSON

  • result - Decompressed JSON object (only for decompress action).
  • error - Error message if compression or decompression fails.

Dependencies

  • pako library for compression and decompression

Troubleshooting

  • Ensure the input data is valid JSON or text when compressing; invalid JSON will fallback to a default object.
  • When decompressing, ensure the input is a valid base64url encoded compressed string; otherwise, parsing will fail.
  • Common errors include JSON parsing errors or invalid base64 input, which will be returned in the error output field.

Links

Discussion