class Zstd::Compress::Context

Overview

Usage:

cctx = Zstd::Compress::Context.new
buf = Bytes.new 22
cbuf = cctx.compress buf

Defined in:

zstd/compress/context.cr

Constructors

Instance Method Summary

Instance methods inherited from class Zstd::Context

close close, dup dup, finalize finalize

Constructor Detail

def self.new(level : Int32 = LEVEL_DEFAULT, *, dict : Zstd::Dict | Nil = nil) #

[View source]

Instance Method Detail

def checksum=(value : Bool) : Bool #

[View source]
def checksum? : Bool #

[View source]
def compress(src : Bytes, dst : Bytes = Bytes.new(compress_bound(src.bytesize))) : Bytes #

[View source]
def compress_bound(size) #

Maximum output buffer size for compression


[View source]
def dict : Zstd::Dict? #

[View source]
def dict=(d : Zstd::Dict) #

Overrides compression level.


[View source]
def level #

[View source]
def level=(val) #

[View source]
def memsize #

Give the current memory usage of zstd context.

Note that object memory usage can evolve (increase or decrease) over time.


[View source]
def threads #

[View source]
def threads=(val) #

[View source]