• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

cmd/lz4c/H21-Apr-2020-

fuzz/H03-May-2022-

internal/xxh32/H21-Apr-2020-

testdata/H03-May-2022-

.gitignoreH A D21-Apr-2020517

.travis.ymlH A D21-Apr-2020302

LICENSEH A D21-Apr-20201.4 KiB

README.mdH A D21-Apr-20202.4 KiB

bench_test.goH A D21-Apr-20204.1 KiB

block.goH A D21-Apr-202010.4 KiB

block_test.goH A D21-Apr-20203.9 KiB

debug.goH A D21-Apr-2020351

debug_stub.goH A D21-Apr-202094

decode_amd64.goH A D21-Apr-2020117

decode_amd64.sH A D21-Apr-20206 KiB

decode_other.goH A D21-Apr-20202.1 KiB

decode_test.goH A D21-Apr-20202.3 KiB

errors.goH A D21-Apr-20201 KiB

example_test.goH A D21-Apr-20201.2 KiB

lz4.goH A D21-Apr-20203.9 KiB

lz4_go1.10.goH A D21-Apr-2020526

lz4_notgo1.10.goH A D21-Apr-2020522

reader.goH A D21-Apr-20208.2 KiB

reader_test.goH A D21-Apr-20202.4 KiB

writer.goH A D21-Apr-202010.3 KiB

writer_test.goH A D21-Apr-20203.6 KiB

README.md

1# lz4 : LZ4 compression in pure Go
2
3[![GoDoc](https://godoc.org/github.com/pierrec/lz4?status.svg)](https://godoc.org/github.com/pierrec/lz4)
4[![Build Status](https://travis-ci.org/pierrec/lz4.svg?branch=master)](https://travis-ci.org/pierrec/lz4)
5[![Go Report Card](https://goreportcard.com/badge/github.com/pierrec/lz4)](https://goreportcard.com/report/github.com/pierrec/lz4)
6[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/pierrec/lz4.svg?style=social)](https://github.com/pierrec/lz4/tags)
7
8## Overview
9
10This package provides a streaming interface to [LZ4 data streams](http://fastcompression.blogspot.fr/2013/04/lz4-streaming-format-final.html) as well as low level compress and uncompress functions for LZ4 data blocks.
11The implementation is based on the reference C [one](https://github.com/lz4/lz4).
12
13## Install
14
15Assuming you have the go toolchain installed:
16
17```
18go get github.com/pierrec/lz4
19```
20
21There is a command line interface tool to compress and decompress LZ4 files.
22
23```
24go install github.com/pierrec/lz4/cmd/lz4c
25```
26
27Usage
28
29```
30Usage of lz4c:
31  -version
32        print the program version
33
34Subcommands:
35Compress the given files or from stdin to stdout.
36compress [arguments] [<file name> ...]
37  -bc
38        enable block checksum
39  -l int
40        compression level (0=fastest)
41  -sc
42        disable stream checksum
43  -size string
44        block max size [64K,256K,1M,4M] (default "4M")
45
46Uncompress the given files or from stdin to stdout.
47uncompress [arguments] [<file name> ...]
48
49```
50
51
52## Example
53
54```
55// Compress and uncompress an input string.
56s := "hello world"
57r := strings.NewReader(s)
58
59// The pipe will uncompress the data from the writer.
60pr, pw := io.Pipe()
61zw := lz4.NewWriter(pw)
62zr := lz4.NewReader(pr)
63
64go func() {
65	// Compress the input string.
66	_, _ = io.Copy(zw, r)
67	_ = zw.Close() // Make sure the writer is closed
68	_ = pw.Close() // Terminate the pipe
69}()
70
71_, _ = io.Copy(os.Stdout, zr)
72
73// Output:
74// hello world
75```
76
77## Contributing
78
79Contributions are very welcome for bug fixing, performance improvements...!
80
81- Open an issue with a proper description
82- Send a pull request with appropriate test case(s)
83
84## Contributors
85
86Thanks to all [contributors](https://github.com/pierrec/lz4/graphs/contributors)  so far!
87
88Special thanks to [@Zariel](https://github.com/Zariel) for his asm implementation of the decoder.
89
90Special thanks to [@klauspost](https://github.com/klauspost) for his work on optimizing the code.
91