io

package
v2.8.21 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NopCloser = NewCloser(func() error {
	return nil
})

Functions

func Close

func Close(c Closer)

Close is a convenience function to close a object that has a Close() method, ignoring any errors Used to satisfy errcheck lint

func NewByteReadSeeker

func NewByteReadSeeker(data []byte) *byteReadSeeker

func NewComposableFS

func NewComposableFS(innerFS ...fs.FS) *composableFS

NewComposableFS creates files system that attempts reading file from multiple wrapped file systems

func NewSubDirFS

func NewSubDirFS(dir string, fs fs.FS) *subDirFs

NewSubDirFS returns file system that represents sub-directory in a wrapped file system

Types

type Closer

type Closer interface {
	Close() error
}

func NewCloser

func NewCloser(close func() error) Closer

type RandomizedTempPaths

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

RandomizedTempPaths allows generating and memoizing random paths, each path being mapped to a specific key.

func NewRandomizedTempPaths

func NewRandomizedTempPaths(root string) *RandomizedTempPaths

func (*RandomizedTempPaths) Add

func (p *RandomizedTempPaths) Add(key string, value string)

func (*RandomizedTempPaths) GetPath

func (p *RandomizedTempPaths) GetPath(key string) (string, error)

GetPath generates a path for the given key or returns previously generated one.

func (*RandomizedTempPaths) GetPathIfExists

func (p *RandomizedTempPaths) GetPathIfExists(key string) string

GetPathIfExists gets a path for the given key if it exists. Otherwise, returns an empty string.

func (*RandomizedTempPaths) GetPaths

func (p *RandomizedTempPaths) GetPaths() map[string]string

GetPaths gets a copy of the map of paths.

type TempPaths

type TempPaths interface {
	Add(key string, value string)
	GetPath(key string) (string, error)
	GetPathIfExists(key string) string
	GetPaths() map[string]string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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