module Eagle::Codecs::Zlib

Overview

Pure-Crystal DEFLATE and zlib, so PNG works everywhere without libz, including WebAssembly.

Defined in:

eagle/assets/codecs/zlib.cr

Constant Summary

LENGTH_BASE = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258]

--- inflate -------------------------------------------------------------

Class Method Summary

Class Method Detail

def self.adler32(data : Bytes) : UInt32 #

--- deflate ------------------------------------------------------------- The Adler-32 checksum used by zlib.


def self.compress(data : Bytes, level : Int32 = 6) : Bytes #

Compresses to zlib-wrapped data.


def self.decompress(data : Bytes, expected_size : Int32 = 0) : Bytes #

Decompresses zlib-wrapped data and verifies its checksum.


def self.deflate(data : Bytes, level : Int32 = 6) : Bytes #

Compresses to raw DEFLATE. level 0 stores without compression.


def self.inflate(data : Bytes, expected_size : Int32 = 0) : Bytes #

Decompresses raw DEFLATE data. expected_size preallocates the output when you know it.