File: README.md

package info (click to toggle)
golang-github-alcortesm-tgz 0.0~git20161220.9c5fe88-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 96 kB
  • sloc: makefile: 3
file content (41 lines) | stat: -rw-r--r-- 952 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# tgz [![GoDoc](https://godoc.org/github.com/alcortesm/tgz?status.svg)](https://godoc.org/github.com/alcortesm/tgz) [![Build Status](https://travis-ci.org/alcortesm/tgz.svg)](https://travis-ci.org/alcortesm/tgz) [![codecov](https://codecov.io/gh/alcortesm/tgz/branch/master/graph/badge.svg)](https://codecov.io/gh/alcortesm/tgz)


A Go library to extract tgz files to temporal directories.

# Example

The following program will decompress the file "/tmp/foo.tgz" to a temporal
directory, print the names of all the files and directories in it and delete the
temporal directory:

```go
package main

import (
	"fmt"
	"io/ioutil"
	"os"

	"github.com/alcortesm/tgz"
)

func main() {
	tmpPath, err := tgz.Extract("/tmp/foo.tgz")
	if tmpPath != "" {
		defer os.RemoveAll(tmpPath)
	}
	if err != nil {
		panic(err)
	}

	infos, err := ioutil.ReadDir(tmpPath)
	if err != nil {
		panic(err)
	}

	for _, info := range infos {
		fmt.Println(info.Name())
	}
}
```