Compression
Collection of compression functions.
Methods
gzip
gzip(data: string)Compresses a string using GZIP.
Parameters
data string
The data to compress.
Return type
string
Examples
// Compress a string using GZIP
Compression.gzip('Hello, world!')gunzip
gunzip(data: string)Decompresses a string using GZIP.
Parameters
data string
The data to decompress.
Return type
string
Examples
unzip
Unzips a zip archive and returns the files within the archive. The data of each file is returned as a base64 string, since it is possible a file is binary (e.g. images, PDFs). To get the string contents you will need to decode it using atob() to get the original string contents.
Parameters
data string
The zip archive data to unzip as a base64 string.
Return type
{ files: Array<{ name: string, size: number, crc32: number, type: 'File' | 'Directory', dateLastModified: Date, data: string }> }
Examples
Last updated