file

package
v0.0.0-...-7429fd7 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2015 License: MIT Imports: 12 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Checksum32

func Checksum32(path string) uint32

Checksum32 create a crc32 checksum for file at path.

func Copy

func Copy(src, dest string) error

Copy copies a file from src to dest.

func Equal

func Equal(fid1, fid2 FID) bool

Equal compares to FIDs for equality. It can be used to check if a file has changed.

func Exists

func Exists(path string) bool

Exists returns true if path exists.

func Hash

func Hash(hasher hash.Hash, path string) ([]byte, error)

Hash creates a hash on file path path using the specified Hash.

func HashStr

func HashStr(hasher hash.Hash, path string) (string, error)

HashStr creates a hexadecimal string of the hash of the file at path using the specified Hash.

func IsDir

func IsDir(path string) bool

IsDir returns true if path is a directory.

func NormalizePath

func NormalizePath(path string) string

NormalizePath converts all slashes in a path to '/' (forward) slashes

Types

type ExFileInfo

type ExFileInfo interface {
	os.FileInfo       // Support the os.FileInfo interface
	Path() string     // Full path of file
	CTime() time.Time // Creation time
	ATime() time.Time // Last access time
	FID() FID         // System independent File ID
}

ExFileInfo is an extended version of the os.FileInfo interface that includes additional information.

func ExStat

func ExStat(path string) (fileInfo ExFileInfo, err error)

ExStat is an extended version of the os.Stat() method.

type FID

type FID struct {
	IDLow  uint64
	IDHigh uint64
}

FID represents a file identifier. On Linux it is the INode. On Windows it is the file index and volume serial number.

type TarReader

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

TarReader type contains all the artifacts needed to unpack a tar file.

func NewTar

func NewTar(path string) (*TarReader, error)

NewTar creates a new TarReader.

func NewTarGz

func NewTarGz(path string) (*TarReader, error)

NewTarGz create a new TarReader for a tar file that has been gzipped.

func (*TarReader) Unpack

func (tr *TarReader) Unpack(toPath string) error

Unpack will unpack a tar file contained in the TarReader. It writes the new entires to the toPath. Unpack takes care of closing the underlying artifacts (file, and gzip stream) for the TarReader. You cannot call Unpack twice for the same TarReader.

Jump to

Keyboard shortcuts

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