~pierrec/hare-lz4

LZ4 codec
add makefile, licence and update README
blockstream: fix multiple calls when EOF
reader: free resources upon io::EOF

refs

main
browse  log 

clone

read-only
https://git.sr.ht/~pierrec/hare-lz4
read/write
git@git.sr.ht:~pierrec/hare-lz4

You can also use your local clone with git send-email.

#hare-lz4

This package provides the LZ4 compression algorithm for Hare. It aims to provide a simple, readable and robust implementation with performance as a byproduct.

The LZ4 frame format specifications can be found here: https://github.com/lz4/lz4/blob/dev/doc/lz4_Frame_format.md

#Installation

#System-wide installation

make install

#Vendoring

git subtree -P vendor/hare-lz4/ add https://git.sr.ht/~pierrec/hare-lz4 main

#Usage

#Compressing

use compress::lz4;
use io;

fn compress(src: io::handle, dst: io::handle) (void | lz4::error) = {
        const hdr = lz4::new_header();
        const zw = lz4::new_writer(out, hdr, false, [])?;
        defer io::close(&zw)!;
        io::copy(&zw, dst)?;
};

#Decompressing

use compress::lz4;
use io;

fn decompress(src: io::handle, dst: io::handle) (void | lz4::error) = {
        const zr = lz4::new_reader(src)?;
        defer io::close(&zr)!;
        io::copy(dst, &zr)?;
};

#Command line utility

Files can be compressed and decompressed via the utility in cmd/lz4.

cmd/lz4/: LZ4 de/compressor

Usage: cmd/lz4/ [-cC] files...

-c: compress files (fast, low compression ratio)
-C: compress files (slow, high compression ratio)