file

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Descriptor

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

Descriptor contains information about a file and can be used to read the file contents.

func (*Descriptor) Close

func (d *Descriptor) Close() error

Close the file, on some Loader implementations this might be a no-op. It should *always* be called regardless of file.

func (*Descriptor) Path

func (d *Descriptor) Path() string

Path returns the path of the file.

func (*Descriptor) Read

func (d *Descriptor) Read(dest io.Writer, n int64) (int64, error)

Read will read all the contents from the file the Descriptor refers to into the dest writer up n bytes. Will return an io.EOF error if EOF is encountered before n bytes are read.

type DirectoryLoader

type DirectoryLoader interface {
	// NextFile must return io.EOF if there is no next value. The returned
	// descriptor should *always* be closed when no longer needed.
	NextFile() (*Descriptor, error)
}

DirectoryLoader defines an interface which can be used to load files from a directory by iterating over each one in the tree.

func NewDirectoryLoader

func NewDirectoryLoader(root string) DirectoryLoader

NewDirectoryLoader returns a basic DirectoryLoader implementation that will load files from a given root directory path.

func NewTarballLoader

func NewTarballLoader(r io.Reader) DirectoryLoader

NewTarballLoader returns a new DirectoryLoader that reads files out of a gzipped tar archive.

Directories

Path Synopsis
Package url contains helpers for dealing with file paths and URLs.
Package url contains helpers for dealing with file paths and URLs.

Jump to

Keyboard shortcuts

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