filesystem

package
v0.0.0-...-604993b Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: ISC Imports: 8 Imported by: 0

Documentation

Overview

Package filesystem implements extension interfaces and wrappers around the standard fs.FS.

Index

Constants

View Source
const (
	ExecuteOther fs.FileMode = 1 << iota
	WriteOther
	ReadOther

	ExecuteGroup
	WriteGroup
	ReadGroup

	ExecuteUser
	WriteUser
	ReadUser

	Root = "."

	ErrPath     = generic.ConstError("path not valid")
	ErrNotFound = generic.ConstError("file not found")
	ErrNotOpen  = generic.ConstError("file is not open")
	ErrIsDir    = generic.ConstError("file is a directory")
	ErrIsNotDir = generic.ConstError("file is not a directory")
)

Go file permission bits.

Variables

This section is empty.

Functions

func OpenFile

func OpenFile(fsys fs.FS, name string, flag int, perm fs.FileMode) (fs.File, error)

func StreamDir

func StreamDir(ctx context.Context, count int, directory fs.ReadDirFile) <-chan StreamDirEntry

StreamDir reads the directory and returns a channel of directory entry results.

If `directory` implements StreamDirFile, StreamDir calls `directory.StreamDir`. Otherwise, StreamDir calls `directory.ReadDir` repeatedly with `count` until the entire directory is read, an error is encountered, or the context is done.

func Truncate

func Truncate(fsys fs.FS, name string, size int64) error

Types

type AccessTimeInfo

type AccessTimeInfo interface {
	fs.FileInfo
	AccessTime() time.Time
}

type ChangeTimeInfo

type ChangeTimeInfo interface {
	fs.FileInfo
	ChangeTime() time.Time
}

type CreateFileFS

type CreateFileFS interface {
	fs.FS
	CreateFile(name string) (fs.File, error)
}

type CreationTimeInfo

type CreationTimeInfo interface {
	fs.FileInfo
	CreationTime() time.Time
}

type Host

type Host string

Host represents a file system host API. (9P, Fuse, et al.)

type ID

type ID string

ID represents a particular file system implementation. (IPFS, IPNS, et al.)

type IDFS

type IDFS interface {
	fs.FS
	ID() ID
}

type MkdirFS

type MkdirFS interface {
	fs.FS
	Mkdir(name string, perm fs.FileMode) error
}

type OpenFileFS

type OpenFileFS interface {
	fs.FS
	OpenFile(name string, flag int, perm fs.FileMode) (fs.File, error)
}

type RemoveFS

type RemoveFS interface {
	fs.FS
	Remove(name string) error
}

type RenameFS

type RenameFS interface {
	fs.FS
	Rename(oldName, newName string) error
}

type StreamDirEntry

type StreamDirEntry interface {
	fs.DirEntry
	Error() error
}

type StreamDirFile

type StreamDirFile interface {
	fs.ReadDirFile
	// StreamDir shares [fs.ReadDirFile]'s position,
	// and sends entries until either the last entry
	// is sent or the directory is closed.
	StreamDir() <-chan StreamDirEntry
}

A StreamDirFile is a directory file whose entries can be received with the StreamDir method.

type SymlinkFS

type SymlinkFS interface {
	fs.FS
	Symlink(oldname, newname string) error
	Readlink(name string) (string, error)
}

type TruncateFile

type TruncateFile interface {
	fs.File
	Truncate(size int64) error
}

type TruncateFileFS

type TruncateFileFS interface {
	fs.FS
	Truncate(name string, size int64) error
}

Directories

Path Synopsis
Package p9 implements file systems for the Plan 9 File Protocol.
Package p9 implements file systems for the Plan 9 File Protocol.
Package cgofuse implements a wrapper around [fs.FS] to make it compatible with the [fuse.FileSystemHost] interface.
Package cgofuse implements a wrapper around [fs.FS] to make it compatible with the [fuse.FileSystemHost] interface.
lock
Package lock implements file system operation locks based around hierarchical `/` delimited paths.
Package lock implements file system operation locks based around hierarchical `/` delimited paths.
Package errors defines a set of annotations to be used when translating between [fs.PathError] and non-Go error values.
Package errors defines a set of annotations to be used when translating between [fs.PathError] and non-Go error values.
Package ipfs implements [fs.FS] wrappers around various IPFS APIS.
Package ipfs implements [fs.FS] wrappers around various IPFS APIS.

Jump to

Keyboard shortcuts

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