open-vault/vendor/github.com/ulikunitz/xz
Hridoy Roy 4a96126d5a
Revert "Vault Dependency Upgrades [VAULT-871] (#10903)" (#10939)
This reverts commit eb74ca61fc4dcb7038f39defb127d5d639ba0ca1.
2021-02-18 15:40:18 -05:00
..
internal Revert "Vault Dependency Upgrades [VAULT-871] (#10903)" (#10939) 2021-02-18 15:40:18 -05:00
lzma Revert "Vault Dependency Upgrades [VAULT-871] (#10903)" (#10939) 2021-02-18 15:40:18 -05:00
.gitignore Vault Debug (#7375) 2019-10-15 15:39:19 -07:00
LICENSE Revert "Vault Dependency Upgrades [VAULT-871] (#10903)" (#10939) 2021-02-18 15:40:18 -05:00
README.md Vault Debug (#7375) 2019-10-15 15:39:19 -07:00
TODO.md Revert "Vault Dependency Upgrades [VAULT-871] (#10903)" (#10939) 2021-02-18 15:40:18 -05:00
bits.go Revert "Vault Dependency Upgrades [VAULT-871] (#10903)" (#10939) 2021-02-18 15:40:18 -05:00
crc.go Revert "Vault Dependency Upgrades [VAULT-871] (#10903)" (#10939) 2021-02-18 15:40:18 -05:00
format.go Revert "Vault Dependency Upgrades [VAULT-871] (#10903)" (#10939) 2021-02-18 15:40:18 -05:00
fox-check-none.xz sdk/gomod: remove dependency on vault (#9449) 2020-07-16 16:24:07 -07:00
fox.xz Vault Debug (#7375) 2019-10-15 15:39:19 -07:00
go.mod sdk/gomod: remove dependency on vault (#9449) 2020-07-16 16:24:07 -07:00
lzmafilter.go Revert "Vault Dependency Upgrades [VAULT-871] (#10903)" (#10939) 2021-02-18 15:40:18 -05:00
make-docs Vault Debug (#7375) 2019-10-15 15:39:19 -07:00
none-check.go Revert "Vault Dependency Upgrades [VAULT-871] (#10903)" (#10939) 2021-02-18 15:40:18 -05:00
reader.go Revert "Vault Dependency Upgrades [VAULT-871] (#10903)" (#10939) 2021-02-18 15:40:18 -05:00
writer.go Revert "Vault Dependency Upgrades [VAULT-871] (#10903)" (#10939) 2021-02-18 15:40:18 -05:00

README.md

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