Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
cmd/lz4c/ | H | 21-Apr-2020 | - | |||
fuzz/ | H | 03-May-2022 | - | |||
internal/xxh32/ | H | 21-Apr-2020 | - | |||
testdata/ | H | 03-May-2022 | - | |||
.gitignore | H A D | 21-Apr-2020 | 517 | |||
.travis.yml | H A D | 21-Apr-2020 | 302 | |||
LICENSE | H A D | 21-Apr-2020 | 1.4 KiB | |||
README.md | H A D | 21-Apr-2020 | 2.4 KiB | |||
bench_test.go | H A D | 21-Apr-2020 | 4.1 KiB | |||
block.go | H A D | 21-Apr-2020 | 10.4 KiB | |||
block_test.go | H A D | 21-Apr-2020 | 3.9 KiB | |||
debug.go | H A D | 21-Apr-2020 | 351 | |||
debug_stub.go | H A D | 21-Apr-2020 | 94 | |||
decode_amd64.go | H A D | 21-Apr-2020 | 117 | |||
decode_amd64.s | H A D | 21-Apr-2020 | 6 KiB | |||
decode_other.go | H A D | 21-Apr-2020 | 2.1 KiB | |||
decode_test.go | H A D | 21-Apr-2020 | 2.3 KiB | |||
errors.go | H A D | 21-Apr-2020 | 1 KiB | |||
example_test.go | H A D | 21-Apr-2020 | 1.2 KiB | |||
lz4.go | H A D | 21-Apr-2020 | 3.9 KiB | |||
lz4_go1.10.go | H A D | 21-Apr-2020 | 526 | |||
lz4_notgo1.10.go | H A D | 21-Apr-2020 | 522 | |||
reader.go | H A D | 21-Apr-2020 | 8.2 KiB | |||
reader_test.go | H A D | 21-Apr-2020 | 2.4 KiB | |||
writer.go | H A D | 21-Apr-2020 | 10.3 KiB | |||
writer_test.go | H A D | 21-Apr-2020 | 3.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