dreamworkAPI
Ctrl K
GitHub
libraryDocs / lzw

lzw

librarysharedmenusource

Lempel–Ziv–Welch (LZW) is a universal lossless compression algorithm created by Abraham Lempel, Jacob Ziv, and Terry Welch.

Classes & types

Functions

lzw.compressCompresses a string using variable-width LZW, the format is set by the options.
lzw.decompressDecompresses a variable-width LZW string, the options must match the compression ones.

#lzw.compress

sharedmenunodiscardsource
function lzw.compress(raw_data: string, options?: lzw.Options): string

Compresses a string using variable-width LZW, the format is set by the options.

Parameters
NameTypeDescription
raw_datastringThe string to compress.
optionsoptionallzw.OptionsThe format options.
Returns
TypeNameDescription
stringcompressed_dataThe compressed string.

#lzw.decompress

sharedmenunodiscardsource
function lzw.decompress(compressed_data: string, options?: lzw.Options): string

Decompresses a variable-width LZW string, the options must match the compression ones.

Without an end code the bits that do not form a whole code are ignored, so formats with codes narrower than a character should use one.

Parameters
NameTypeDescription
compressed_datastringThe string to decompress.
optionsoptionallzw.OptionsThe format options.
Returns
TypeNameDescription
stringdecompressed_dataThe decompressed string.
Generated from the dreamwork meta branch.