0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-05 13:49:10 +01:00
gitea/vendor/github.com/ulikunitz/xz
6543 12a1f914f4
Vendor Update Go Libs (#13166)
* update github.com/alecthomas/chroma v0.8.0 -> v0.8.1

* github.com/blevesearch/bleve v1.0.10 -> v1.0.12

* editorconfig-core-go v2.1.1 -> v2.3.7

* github.com/gliderlabs/ssh v0.2.2 -> v0.3.1

* migrate editorconfig.ParseBytes to Parse

* github.com/shurcooL/vfsgen to 0d455de96546

* github.com/go-git/go-git/v5 v5.1.0 -> v5.2.0

* github.com/google/uuid v1.1.1 -> v1.1.2

* github.com/huandu/xstrings v1.3.0 -> v1.3.2

* github.com/klauspost/compress v1.10.11 -> v1.11.1

* github.com/markbates/goth v1.61.2 -> v1.65.0

* github.com/mattn/go-sqlite3 v1.14.0 -> v1.14.4

* github.com/mholt/archiver v3.3.0 -> v3.3.2

* github.com/microcosm-cc/bluemonday 4f7140c49acb -> v1.0.4

* github.com/minio/minio-go v7.0.4 -> v7.0.5

* github.com/olivere/elastic v7.0.9 -> v7.0.20

* github.com/urfave/cli v1.20.0 -> v1.22.4

* github.com/prometheus/client_golang v1.1.0 -> v1.8.0

* github.com/xanzy/go-gitlab v0.37.0 -> v0.38.1

* mvdan.cc/xurls v2.1.0 -> v2.2.0

Co-authored-by: Lauris BH <lauris@nix.lv>
2020-10-16 01:06:27 -04:00
..
internal Vendor Update Go Libs (#13166) 2020-10-16 01:06:27 -04:00
lzma Vendor Update Go Libs (#13166) 2020-10-16 01:06:27 -04:00
.gitignore Dump: add output format tar and output to stdout (#10376) 2020-06-05 16:47:39 -04:00
bits.go Vendor Update Go Libs (#13166) 2020-10-16 01:06:27 -04:00
crc.go Vendor Update Go Libs (#13166) 2020-10-16 01:06:27 -04:00
format.go Vendor Update Go Libs (#13166) 2020-10-16 01:06:27 -04:00
fox-check-none.xz Vendor Update Go Libs (#13166) 2020-10-16 01:06:27 -04:00
fox.xz Dump: add output format tar and output to stdout (#10376) 2020-06-05 16:47:39 -04:00
go.mod Vendor Update Go Libs (#13166) 2020-10-16 01:06:27 -04:00
LICENSE Vendor Update Go Libs (#13166) 2020-10-16 01:06:27 -04:00
lzmafilter.go Vendor Update Go Libs (#13166) 2020-10-16 01:06:27 -04:00
make-docs Dump: add output format tar and output to stdout (#10376) 2020-06-05 16:47:39 -04:00
none-check.go Vendor Update Go Libs (#13166) 2020-10-16 01:06:27 -04:00
reader.go Vendor Update Go Libs (#13166) 2020-10-16 01:06:27 -04:00
README.md Dump: add output format tar and output to stdout (#10376) 2020-06-05 16:47:39 -04:00
TODO.md Vendor Update Go Libs (#13166) 2020-10-16 01:06:27 -04:00
writer.go Vendor Update Go Libs (#13166) 2020-10-16 01:06:27 -04:00

Package xz

This Go language package supports the reading and writing of xz compressed streams. It includes also a gxz command for compressing and decompressing data. The package is completely written in Go and doesn't have any dependency on any C code.

The package is currently under development. There might be bugs and APIs are not considered stable. At this time the package cannot compete with the xz tool regarding compression speed and size. The algorithms there have been developed over a long time and are highly optimized. However there are a number of improvements planned and I'm very optimistic about parallel compression and decompression. Stay tuned!

Using the API

The following example program shows how to use the API.

package main

import (
    "bytes"
    "io"
    "log"
    "os"

    "github.com/ulikunitz/xz"
)

func main() {
    const text = "The quick brown fox jumps over the lazy dog.\n"
    var buf bytes.Buffer
    // compress text
    w, err := xz.NewWriter(&buf)
    if err != nil {
        log.Fatalf("xz.NewWriter error %s", err)
    }
    if _, err := io.WriteString(w, text); err != nil {
        log.Fatalf("WriteString error %s", err)
    }
    if err := w.Close(); err != nil {
        log.Fatalf("w.Close error %s", err)
    }
    // decompress buffer and write output to stdout
    r, err := xz.NewReader(&buf)
    if err != nil {
        log.Fatalf("NewReader error %s", err)
    }
    if _, err = io.Copy(os.Stdout, r); err != nil {
        log.Fatalf("io.Copy error %s", err)
    }
}

Using the gxz compression tool

The package includes a gxz command line utility for compression and decompression.

Use following command for installation:

$ go get github.com/ulikunitz/xz/cmd/gxz

To test it call the following command.

$ gxz bigfile

After some time a much smaller file bigfile.xz will replace bigfile. To decompress it use the following command.

$ gxz -d bigfile.xz