tar

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2017 License: MIT Imports: 4 Imported by: 2

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

func NewTarGzFileReader(r io.Reader, f string) (io.ReadCloser, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL