files

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AllReadWrite = os.FileMode(0666)
)

Variables

This section is empty.

Functions

func CreateOpen

func CreateOpen(path string) (*os.File, error)

CreateOpen creates or opens the named file. If the file already exists, it is opend. If the file does not exist, it is created with mode 0666. If successful, methods on the returned File can be used for I/O; the associated file descriptor has mode O_RDWR.

func Open

func Open(path string) (*os.File, error)

func Read

func Read(path string) ([]byte, error)

func Write

func Write(path string, permissions fs.FileMode, content []byte) error

func WriteOpen

func WriteOpen(path string, permissions fs.FileMode, content []byte) (*os.File, error)

Types

type File

type File struct {
	Name     string      // base name of the file
	Size     int64       // length in bytes for regular files; system-dependent for others
	FileMode fs.FileMode // file mode bits
	IsDir    bool        // modification time
	ModTime  time.Time   // abbreviation for Mode().IsDir()
	Content  []byte
}

type FileRunner

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

func New

func New(root string) FileRunner

func (FileRunner) Exclude

func (fr FileRunner) Exclude(joinBy FilterJoin, filters []string) FileRunner

func (FileRunner) Execute

func (fr FileRunner) Execute() (files *Files, err error)

func (FileRunner) Include

func (fr FileRunner) Include(joinBy FilterJoin, filters []string) FileRunner

func (FileRunner) ReadContent

func (fr FileRunner) ReadContent() FileRunner

type Files

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

func NewFiles

func NewFiles(files map[string]File) Files

func (*Files) Content

func (f *Files) Content() map[string]File

func (*Files) CopyContent

func (f *Files) CopyContent(key string) ([]byte, bool)

func (*Files) Read

func (f *Files) Read(key string) (File, bool)

type FilterJoin

type FilterJoin uint8
const (
	AND FilterJoin = 1 << iota
	OR
)

Jump to

Keyboard shortcuts

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