diff options
Diffstat (limited to 'vendor/github.com/ulikunitz/xz/README.md')
-rw-r--r-- | vendor/github.com/ulikunitz/xz/README.md | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/vendor/github.com/ulikunitz/xz/README.md b/vendor/github.com/ulikunitz/xz/README.md new file mode 100644 index 0000000..969ae7a --- /dev/null +++ b/vendor/github.com/ulikunitz/xz/README.md | |||
@@ -0,0 +1,71 @@ | |||
1 | # Package xz | ||
2 | |||
3 | This Go language package supports the reading and writing of xz | ||
4 | compressed streams. It includes also a gxz command for compressing and | ||
5 | decompressing data. The package is completely written in Go and doesn't | ||
6 | have any dependency on any C code. | ||
7 | |||
8 | The package is currently under development. There might be bugs and APIs | ||
9 | are not considered stable. At this time the package cannot compete with | ||
10 | the xz tool regarding compression speed and size. The algorithms there | ||
11 | have been developed over a long time and are highly optimized. However | ||
12 | there are a number of improvements planned and I'm very optimistic about | ||
13 | parallel compression and decompression. Stay tuned! | ||
14 | |||
15 | # Using the API | ||
16 | |||
17 | The following example program shows how to use the API. | ||
18 | |||
19 | package main | ||
20 | |||
21 | import ( | ||
22 | "bytes" | ||
23 | "io" | ||
24 | "log" | ||
25 | "os" | ||
26 | |||
27 | "github.com/ulikunitz/xz" | ||
28 | ) | ||
29 | |||
30 | func main() { | ||
31 | const text = "The quick brown fox jumps over the lazy dog.\n" | ||
32 | var buf bytes.Buffer | ||
33 | // compress text | ||
34 | w, err := xz.NewWriter(&buf) | ||
35 | if err != nil { | ||
36 | log.Fatalf("xz.NewWriter error %s", err) | ||
37 | } | ||
38 | if _, err := io.WriteString(w, text); err != nil { | ||
39 | log.Fatalf("WriteString error %s", err) | ||
40 | } | ||
41 | if err := w.Close(); err != nil { | ||
42 | log.Fatalf("w.Close error %s", err) | ||
43 | } | ||
44 | // decompress buffer and write output to stdout | ||
45 | r, err := xz.NewReader(&buf) | ||
46 | if err != nil { | ||
47 | log.Fatalf("NewReader error %s", err) | ||
48 | } | ||
49 | if _, err = io.Copy(os.Stdout, r); err != nil { | ||
50 | log.Fatalf("io.Copy error %s", err) | ||
51 | } | ||
52 | } | ||
53 | |||
54 | # Using the gxz compression tool | ||
55 | |||
56 | The package includes a gxz command line utility for compression and | ||
57 | decompression. | ||
58 | |||
59 | Use following command for installation: | ||
60 | |||
61 | $ go get github.com/ulikunitz/xz/cmd/gxz | ||
62 | |||
63 | To test it call the following command. | ||
64 | |||
65 | $ gxz bigfile | ||
66 | |||
67 | After some time a much smaller file bigfile.xz will replace bigfile. | ||
68 | To decompress it use the following command. | ||
69 | |||
70 | $ gxz -d bigfile.xz | ||
71 | |||