fs

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: Apache-2.0 Imports: 8 Imported by: 7

Documentation

Overview

Package fs provides a file system interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File interface {
	io.Closer
	io.Reader
	io.ReaderAt
	io.Seeker
	io.Writer
	io.WriterAt

	Stat() (os.FileInfo, error)
	Sync() error
	Truncate(size int64) error

	Slice(start int64, end int64) ([]byte, error)
}

File is the interface compatible with os.File.

type FileSystem

type FileSystem interface {
	OpenFile(name string, flag int, perm os.FileMode) (File, error)
	Stat(name string) (os.FileInfo, error)
	Remove(name string) error
	Rename(oldpath, newpath string) error
	ReadDir(name string) ([]os.FileInfo, error)

	CreateLockFile(name string, perm os.FileMode) (LockFile, bool, error)
}

FileSystem represents a file system.

var Mem FileSystem = &memFS{files: map[string]*memFile{}}

Mem is a file system backed by memory.

var OS FileSystem = &osFS{}

OS is a file system backed by the os package.

var OSMMap FileSystem = &osMMapFS{}

OSMMap is a file system backed by the os package and memory-mapped files.

type LockFile

type LockFile interface {
	Unlock() error
}

LockFile represents a lock file.

Jump to

Keyboard shortcuts

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