flate

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

flate
algorithm
lzw
moonbit
moon add gmlewis/flate@0.36.11
Download zip
Author
Version
0.36.11
License
Apache-2.0
Last updated
8 days ago
Downloads
29K

Dependencies

README

#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.20260803 (c19f78e 2026-08-03) ~/.moon/bin/moon moonc v0.10.6+80dc50f24 (2026-08-04) ~/.moon/bin/moonc moonrun 0.1.20260803 (c19f78e 2026-08-03) ~/.moon/bin/moonrun

#
Reader

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

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

#
Decompressor

type Decompressor

#
Decompressor::make_reader

fn Decompressor::make_reader(self : Decompressor, r : &Reader) -> Unit

#
Decompressor::reset

fn Decompressor::reset(self : Decompressor, r : &Reader, dict :
Slice
[Byte]) -> Unit

#
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

fn Writer::new_dict(w : &
Writer
, dict :
Slice
[Byte]) -> Writer

#
writer_closed_error

let writer_closed_error :
IOError

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io