compress

Generated by tinox doc

General-purpose gzip and raw-DEFLATE compression over byte lists: gzip/gunzip (with a lastGunzipOk() success check, since a corrupt stream can't safely throw through the byte-list API) and deflateRaw/inflateRaw for the headerless variant (e.g. WebSocket permessage-deflate).

Gzip roundtrip

import tinox.core.compress;

class Main
{
    fnc main() -> Int32
    {
        var data: List<Int64> = [];
        let text: String = "hello, tinox! hello, tinox!";
        var i: Int64 = 0;
        while i < text.len()
        {
            data.push(text.charCodeAt(i));
            i = i + 1;
        }

        let compressed: List<Int64> = Compress::gzip(data);
        println("compressed size: " + compressed.len().toString());

        let restored: List<Int64> = Compress::gunzip(compressed);
        println("gunzip ok: " + Compress::lastGunzipOk().toString());
        println("restored size: " + restored.len().toString());
        return 0;
    }
}

fn tinoxDeflateRaw(bytes: List<Int64>) → List<Int64>

fn tinoxInflateRaw(bytes: List<Int64>) → List<Int64>

fn wsLastInflateOk() → Bool

fn tinoxGzip(bytes: List<Int64>) → List<Int64>

fn tinoxGunzip(bytes: List<Int64>) → List<Int64>

fn tinoxLastGunzipOk() → Bool

class Compress

Methods

fnc gzip(bytes: List<Int64>) → List<Int64>
fnc gunzip(bytes: List<Int64>) → List<Int64>
fnc lastGunzipOk() → Bool
fnc deflateRaw(bytes: List<Int64>) → List<Int64>
fnc inflateRaw(bytes: List<Int64>) → List<Int64>
fnc lastInflateOk() → Bool