Skip to content

alcortesm/tgz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tgz GoDoc Build Status codecov

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:

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())
	}
}

About

A Go library to extract tgz files to temporal directories.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages