package core:compress/lzma

⌘K
Ctrl+K
or
/

    Overview

    An implementation of the LZMA and LZMA2 compression methods

    Reads and writes .lzma files, raw LZMA streams as stored in 7z and zip (method 14), and raw LZMA2 streams as used by xz and 7z. It is a port of Igor Pavlov's public domain LZMA SDK, and the encoder's output is byte-identical to the SDK's.

    Types

    Level ¶

    Level :: enum i32 {
    	Level_0 = 0, 
    	Level_1 = 1, 
    	Level_2 = 2, 
    	Level_3 = 3, 
    	Level_4 = 4, 
    	Level_5 = 5, 
    	Level_6 = 6, 
    	Level_7 = 7, 
    	Level_8 = 8, 
    	Level_9 = 9, 
    	Fastest = Level_0, 
    	Default = Level_6, 
    	Best    = Level_9, 
    }

    Related Procedures With Parameters

    Match_Finder_Kind ¶

    Match_Finder_Kind :: enum u8 {
    	HC4, 
    	HC5, 
    	BT2, 
    	BT3, 
    	BT4, 
    	BT5, 
    }

    Options ¶

    Options :: struct {
    	lc:           u8,
    	lp:           u8,
    	pb:           u8,
    	dict_size:    u32,
    	fast:         bool,
    	nice_len:     u32,
    	depth:        u32,
    	match_finder: Match_Finder_Kind,
    	end_marker:   bool,
    }

    Related Procedures With Parameters

    Properties ¶

    Properties :: struct {
    	lc:        u8,
    	lp:        u8,
    	pb:        u8,
    	dict_size: u32,
    }

    Related Procedures With Parameters

    Related Procedures With Returns

    Related Constants

    Constants

    DEFAULT_PROPERTIES ¶

    DEFAULT_PROPERTIES :: Properties{lc = 3, lp = 0, pb = 2, dict_size = 8 << 20}

    HEADER_SIZE ¶

    HEADER_SIZE :: PROPERTIES_SIZE + 8

    Variables

    This section is empty.

    Procedures

    compress_bound ¶

    compress_bound :: proc(length: int) -> int {…}

    compress_lzma2_bound ¶

    compress_lzma2_bound :: proc(length: int) -> int {…}

    compress_lzma2_to_dynamic ¶

    compress_lzma2_to_dynamic :: proc(
    	output:    ^[dynamic]u8, 
    	input:     []u8, 
    	options:   Options, 
    	allocator := context.allocator, 
    ) -> (props: Properties, err: compress.Error) {…}

    compress_lzma2_to_slice ¶

    compress_lzma2_to_slice :: proc(
    	output, input: []u8, 
    	options:       Options, 
    	allocator := context.allocator, 
    ) -> (written: int, props: Properties, err: compress.Error) {…}

    compress_raw_to_dynamic ¶

    compress_raw_to_dynamic :: proc(
    	output:    ^[dynamic]u8, 
    	input:     []u8, 
    	options:   Options, 
    	allocator := context.allocator, 
    ) -> (props: Properties, err: compress.Error) {…}

    compress_raw_to_slice ¶

    compress_raw_to_slice :: proc(
    	output, input: []u8, 
    	options:       Options, 
    	allocator := context.allocator, 
    ) -> (written: int, props: Properties, err: compress.Error) {…}

    compress_to_dynamic ¶

    compress_to_dynamic :: proc(
    	output:    ^[dynamic]u8, 
    	input:     []u8, 
    	level:     Level = Level.Default, 
    	allocator := context.allocator, 
    ) -> (err: compress.Error) {…}

    compress_to_slice ¶

    compress_to_slice :: proc(
    	output, input: []u8, 
    	level:         Level = Level.Default, 
    	allocator := context.allocator, 
    ) -> (written: int, err: compress.Error) {…}

    decode_properties ¶

    decode_properties :: proc "contextless" (data: []u8) -> (props: Properties, err: compress.Error) {…}

    decompress_from_bytes ¶

    decompress_from_bytes :: proc(
    	output:               ^[dynamic]u8, 
    	input:                []u8, 
    	expected_output_size: int = -1, 
    	max_output_size:      int = compress.COMPRESS_OUTPUT_ALLOCATE_MAX, 
    	allocator := context.allocator, 
    ) -> (err: compress.Error) {…}

    decompress_from_context ¶

    decompress_from_context :: proc(
    	z:                    ^compress.Context, 
    	expected_output_size: int = -1, 
    	max_output_size:      int = compress.COMPRESS_OUTPUT_ALLOCATE_MAX, 
    	allocator := context.allocator, 
    ) -> (err: compress.Error) {…}

    decompress_lzma2_from_bytes ¶

    decompress_lzma2_from_bytes :: proc(
    	output:               ^[dynamic]u8, 
    	input:                []u8, 
    	dict_size:            u32, 
    	expected_output_size: int = -1, 
    	max_output_size:      int = compress.COMPRESS_OUTPUT_ALLOCATE_MAX, 
    	allocator := context.allocator, 
    ) -> (err: compress.Error) {…}

    decompress_lzma2_from_context ¶

    decompress_lzma2_from_context :: proc(
    	z:                    ^compress.Context, 
    	dict_size:            u32, 
    	expected_output_size: int = -1, 
    	max_output_size:      int = compress.COMPRESS_OUTPUT_ALLOCATE_MAX, 
    	allocator := context.allocator, 
    ) -> (err: compress.Error) {…}

    decompress_raw_from_bytes ¶

    decompress_raw_from_bytes :: proc(
    	output:               ^[dynamic]u8, 
    	input:                []u8, 
    	props:                Properties, 
    	expected_output_size: int = -1, 
    	max_output_size:      int = compress.COMPRESS_OUTPUT_ALLOCATE_MAX, 
    	allocator := context.allocator, 
    ) -> (err: compress.Error) {…}

    decompress_raw_from_context ¶

    decompress_raw_from_context :: proc(
    	z:                    ^compress.Context, 
    	props:                Properties, 
    	expected_output_size: int = -1, 
    	max_output_size:      int = compress.COMPRESS_OUTPUT_ALLOCATE_MAX, 
    	allocator := context.allocator, 
    ) -> (err: compress.Error) {…}

    encode_properties ¶

    encode_properties :: proc "contextless" (props: Properties) -> (data: [5]u8) {…}

    level_options ¶

    level_options :: proc(level: Level = Level.Default) -> (options: Options) {…}

    lzma2_dict_prop ¶

    lzma2_dict_prop :: proc "contextless" (dict_size: u32) -> (prop: u8) {…}

    lzma2_dict_size ¶

    lzma2_dict_size :: proc "contextless" (prop: u8) -> (dict_size: u32, err: compress.Error) {…}

    Procedure Groups

    Source Files

    Generation Information

    Generated with odin version dev-2026-11 (vendor "odin") Windows_amd64 @ 2026-11-10 03:07:04.374188700 +0000 UTC