archive

package
v0.0.0-...-28a84a6 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

README

Notice

The contents of this directory / archive package come from the Cloud Native Buildpacks pack utility which is licensed under the Apache 2 license. Specifically we are including code from this internal package: https://github.com/buildpacks/pack/tree/10f5f0a357ccc0b8cc4cabf7ee9a70814386f0cd/internal/archive

TODO include the full license once this issue is complete: https://github.com/buildpacks/pack/issues/813

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEntryNotExist = errors.New("not exist")

ErrEntryNotExist is an error returned if an entry path doesn't exist

View Source
var NormalizedDateTime time.Time

Functions

func GenerateTar

func GenerateTar(genFn func(TarWriter) error) io.ReadCloser

func GenerateTarWithWriter

func GenerateTarWithWriter(genFn func(TarWriter) error, twf TarWriterFactory) io.ReadCloser

GenerateTarWithTar returns a reader to a tar from a generator function using a writer from the provided factory. Note that the generator will not fully execute until the reader is fully read from. Any errors returned by the generator will be returned when reading the reader.

func NormalizeHeader

func NormalizeHeader(header *tar.Header, normalizeModTime bool)

NormalizeHeader normalizes a tar.Header

Normalizes the following:

  • ModTime
  • GID
  • UID
  • User Name
  • Group Name

func ReadZipAsTar

func ReadZipAsTar(srcPath, basePath string, uid, gid int, mode int64, normalizeModTime bool, fileFilter func(string) bool) io.ReadCloser

func WriteZipToTar

func WriteZipToTar(tw TarWriter, srcZip, basePath string, uid, gid int, mode int64, normalizeModTime bool, fileFilter func(string) bool) error

WriteZipToTar writes the contents of a zip file to a tar writer.

Types

type TarBuilder

type TarBuilder struct {
	// contains filtered or unexported fields
}

func (*TarBuilder) AddDir

func (t *TarBuilder) AddDir(path string, mode int64, modTime time.Time)

func (*TarBuilder) AddFile

func (t *TarBuilder) AddFile(path string, mode int64, modTime time.Time, contents []byte)

func (*TarBuilder) Reader

func (t *TarBuilder) Reader(twf TarWriterFactory) io.ReadCloser

func (*TarBuilder) WriteTo

func (t *TarBuilder) WriteTo(w io.Writer, twf TarWriterFactory) (int64, error)

func (*TarBuilder) WriteToPath

func (t *TarBuilder) WriteToPath(path string, twf TarWriterFactory) error

type TarWriter

type TarWriter interface {
	WriteHeader(hdr *tar.Header) error
	Write(b []byte) (int, error)
	Close() error
}

type TarWriterFactory

type TarWriterFactory interface {
	NewWriter(io.Writer) TarWriter
}

func DefaultTarWriterFactory

func DefaultTarWriterFactory() TarWriterFactory

Jump to

Keyboard shortcuts

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