Sign in

    flate

    MoonBit flate: provide simplified flate (LZW) compression algorithm.

    flate
    algorithm
    lzw
    moonbit
    Download zip
    Author
    Version
    0.35.13
    License
    Apache-2.0
    Last updated
    last year
    Downloads
    63K

    #gmlewis/flate

    check

    This is a simplified flate compression algorithm based on Go's implementation: https://cs.opensource.google/go/go/+/refs/tags/go1.23.1:src/compress/flate/deflatefast.go which has the copyright notice:

    // Copyright 2016 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file.

    #Status

    The code has been updated to support compiler:

    $ moon version --all moon 0.1.20250612 (2a026e0 2025-06-12) ~/.moon/bin/moon moonc v0.1.20250612+600461c34 ~/.moon/bin/moonc moonrun 0.1.20250612 (2a026e0 2025-06-12) ~/.moon/bin/moonrun

    Reader

    pub(open) trait Reader {
    read(Self,
    Slice
    [Byte]) -> (Int,
    IOError
    ?)
    read_byte(Self) -> (Byte,
    IOError
    ?)
    }

    The actual read interface needed by [Decompressor::new].

    Decompressor

    type Decompressor

    DictWriter

    type DictWriter

    Writer

    type Writer

    impl Closer for Writer
    impl Writer for Writer

    Writer::new

    Writer::new returns a new [@io.WriteCloser] compressing data at the "BestSpeed" level. It writes its (compressed) data to the provided buf.

    Writer::new_dict

    Reader

    Reader::new

    fn Reader::new(r : Reader) -> Decompressor

    Reader::new returns a new [@io.ReadCloser] that can be used to read the uncompressed version of r.

    Reader::new_dict

    fn Reader::new_dict(r : Reader, dict :
    Slice
    [Byte]) -> Decompressor

    Reader::new_dict is like [NewReader] but initializes the reader with a preset dictionary. The returned [Reader] behaves as if the uncompressed data stream started with the given dictionary, which has already been read. NewReaderDict is typically used to read data compressed by NewWriterDict.
    impl Reader for Reader

    writer_closed_error

    let writer_closed_error :
    IOError

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io