Documentation
¶
Overview ¶
Package tar extends the archive/tar package in the stdlib.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrFileNotFound indicates that we reached the end of the archive without finding the file.. ErrFileNotFound = errors.New("file not found in the archive") // ErrNotAFile indicates that there is a match for the path, but it's not a file (eg. it's a directory). ErrNotAFile = errors.New("not a file") )
Functions ¶
func NewTarGzFileReader ¶
NewTarGzFileReader returns a new Reader which reads a specific file from a .tar.gz archive.
Example ¶
package main
import (
"fmt"
"io/ioutil"
"os"
"github.com/goph/stdlib/archive/tar"
)
func main() {
tgz, _ := os.Open("testdata/test.tar.gz")
reader, _ := tar.NewTarGzFileReader(tgz, "test.txt")
contents, _ := ioutil.ReadAll(reader)
fmt.Println(string(contents))
}
Output: test
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.