vfs

package
v0.0.0-...-b05aa3b Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cascade

type Cascade []Reader

func (Cascade) Append

func (c Cascade) Append(filename string) (File, error)

func (Cascade) Close

func (c Cascade) Close() (last error)

func (Cascade) Create

func (c Cascade) Create(filename string) (File, error)

func (Cascade) FirstWritable

func (c Cascade) FirstWritable() Writer

func (Cascade) MkdirAll

func (c Cascade) MkdirAll(dir string) error

func (Cascade) Open

func (c Cascade) Open(filename string) (File, error)

func (Cascade) ReadDir

func (c Cascade) ReadDir(dir string) ([]FileInfo, error)

func (Cascade) ReadFile

func (c Cascade) ReadFile(filename string) ([]byte, error)

func (Cascade) ReadOnly

func (c Cascade) ReadOnly() bool

func (Cascade) Remove

func (c Cascade) Remove(name string) error

func (Cascade) Stat

func (c Cascade) Stat(name string) (FileInfo, error)

func (Cascade) Truncate

func (c Cascade) Truncate(name string, size int64) error

func (Cascade) WriteFile

func (c Cascade) WriteFile(filename string, data []byte) error

type File

type File interface {
	io.ReadWriteCloser
}

type FileInfo

type FileInfo = os.FileInfo

type FileMode

type FileMode = os.FileMode

type FileSystem

type FileSystem struct {
	Path     string
	Writable bool
}

func (FileSystem) Append

func (fs FileSystem) Append(filename string) (File, error)

Append open file in append mode, create is not exist

func (FileSystem) Close

func (fs FileSystem) Close() error

func (FileSystem) Create

func (fs FileSystem) Create(filename string) (File, error)

Create creates the named file with mode 0666 (before umask), truncating it if it already exists. If successful, methods on the returned File can be used for I/O; the associated file descriptor has mode O_RDWR. If there is an error, it will be of type *PathError.

func (FileSystem) MkdirAll

func (fs FileSystem) MkdirAll(dir string) error

MkdirAll creates a directory named path, along with any necessary parents, and returns nil, or else returns an error.

func (FileSystem) Open

func (fs FileSystem) Open(filename string) (file File, err error)

Open opens the named file for reading. If successful, methods on the returned file can be used for reading; the associated file descriptor has mode O_RDONLY. If there is an error, it will be of type *PathError.

func (FileSystem) ReadDir

func (fs FileSystem) ReadDir(dir string) ([]FileInfo, error)

ReadDir reads the directory named by dirname and returns a list of directory entries sorted by filename.

func (FileSystem) ReadFile

func (fs FileSystem) ReadFile(filename string) (b []byte, err error)

ReadFile reads the file named by filename and returns the contents. A successful call returns err == nil, not err == EOF. Because ReadFile reads the whole file, it does not treat an EOF from Read as an error to be reported.

func (FileSystem) ReadOnly

func (fs FileSystem) ReadOnly() bool

func (FileSystem) Remove

func (fs FileSystem) Remove(name string) error

Remove removes the named file or directory. If there is an error, it will be of type *PathError.

func (FileSystem) Stat

func (fs FileSystem) Stat(name string) (info FileInfo, err error)

Stat returns a FileInfo describing the named file. If there is an error, it will be of type *PathError.

func (FileSystem) Truncate

func (fs FileSystem) Truncate(name string, size int64) error

Truncate changes the size of the named file. If the file is a symbolic link, it changes the size of the link's target. If there is an error, it will be of type *PathError.

func (FileSystem) WriteFile

func (fs FileSystem) WriteFile(filename string, data []byte) error

WriteFile writes data to a file named by filename. If the file does not exist, WriteFile creates it with permissions perm; otherwise WriteFile truncates it before writing.

type Memory

type Memory map[string][]byte

func NewMemory

func NewMemory() Memory

func (Memory) Close

func (m Memory) Close() error

func (Memory) Open

func (m Memory) Open(filename string) (File, error)

func (Memory) ReadDir

func (m Memory) ReadDir(dir string) (infos []FileInfo, err error)

func (Memory) ReadFile

func (m Memory) ReadFile(filename string) ([]byte, error)

func (Memory) ReadOnly

func (m Memory) ReadOnly() bool

func (Memory) Stat

func (m Memory) Stat(name string) (FileInfo, error)

type Reader

type Reader interface {
	io.Closer

	Stat(name string) (FileInfo, error)
	ReadDir(dir string) ([]FileInfo, error)
	ReadFile(filename string) ([]byte, error)
	Open(filename string) (File, error)
	ReadOnly() bool
}

type Writer

type Writer interface {
	Reader

	MkdirAll(dir string) error
	WriteFile(filename string, data []byte) error
	Append(filename string) (File, error)
	Create(filename string) (File, error)
	Truncate(name string, size int64) error
	Remove(name string) error
}

type Zip

type Zip struct {
	Path string
	// contains filtered or unexported fields
}

Zip archive as vfs

func (*Zip) Close

func (z *Zip) Close() error

func (*Zip) Open

func (z *Zip) Open(filename string) (File, error)

func (*Zip) ReadDir

func (z *Zip) ReadDir(dir string) (infos []FileInfo, err error)

func (*Zip) ReadFile

func (z *Zip) ReadFile(filename string) ([]byte, error)

func (*Zip) ReadOnly

func (z *Zip) ReadOnly() bool

func (*Zip) Stat

func (z *Zip) Stat(name string) (FileInfo, error)

Jump to

Keyboard shortcuts

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