Skip to main content

compress-json-jz64

ai-research-agent / datasets/compress-json-jz64

Functions

compressBase64ZipText()

function compressBase64ZipText(dataOrZip, options?): Promise<string>

Compress/decompress any data (such as JSON or text) with JSZip then convert zip binary to a Base64Zip text string which is easier to store in db or files.

Parameters

ParameterTypeDescription

dataOrZip

string

data to compress, or Base64Zip to decompress

options?

{ compressionLevel: number; decompress: boolean; }

options.compressionLevel?

number

default=9 0-9, 9 has smallest size at ~40% but takes longer

options.decompress?

boolean

default=false false to compress, true to decompress

Returns

Promise<string>

base64-encoded string of the zipped data