Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LazyReadCloser ¶
LazyReadCloser is an implementation of io.ReadCloser that defers its own initialization until the first attempted read.
Types ¶
type CustomFileArgs ¶
type CustomFileArgs struct { Name string Size int ModTime time.Time IsDir bool ReadCloser io.ReadCloser }
CustomFileArgs takes all elements that need to be provided to the CustomFile function.
type File ¶
type File interface { // Name returns the base name of the file, not a // full path (see filepath.Base). Name() string // Size returns the size of the file in bytes. If // the file represents a directory the size returned // should be zero. Size() int // ModTime returns the time the file was most // recently modified. ModTime() time.Time // Read implements io.Reader to retrieve file // contents. Read(p []byte) (n int, err error) // Close implements io.Closer. Close() error // IsDir returns true if the File represents a // directory. IsDir() bool }
File represents a file from the filesystem.
func CustomFile ¶
func CustomFile(args CustomFileArgs) File
CustomFile makes it possible to construct a custom file that implements the File interface without necessarily being backed by an actual file on the filesystem.