disk

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Disk

type Disk interface {
	// Exists checks if the provided file or directory exists
	Exists(path string) (bool, error)

	// Read returns the entire file as a byte buffer
	//
	// Returns error if provided path is not a file
	Read(path string) ([]byte, error)

	// Write writes provided byte buffer to the path
	Write(path string, data []byte) error

	// Remove deletes the provided file or directory recursively
	Remove(path string) error

	// MkDir creates the provided directory recursively
	MkDir(path string) error

	// ReadDir returns all entries within the directory
	//
	// Returns error if provided path is not a directory
	ReadDir(path string) ([]Entry, error)

	// Open opens provided path for writing
	Open(path string, flag int) (io.WriteCloser, error)
}

func FromPath

func FromPath(path string) (Disk, error)

type Entry

type Entry interface {
	IsDir() bool
	Name() string
}

Jump to

Keyboard shortcuts

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