fake

package
v0.0.0-...-1a8a335 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	sync.RWMutex // protects this File's content and metadata
	// contains filtered or unexported fields
}

File implements File interface

func NewFile

func NewFile(fs *Filesystem, parent *File, name string, mode os.FileMode, modTime time.Time, isDir bool) *File

NewFile creates a new File

func (*File) Close

func (ff *File) Close() error

Close closes the File

func (*File) IsDir

func (ff *File) IsDir() bool

IsDir returns true if directory

func (*File) ModTime

func (ff *File) ModTime() time.Time

ModTime returns the modification time

func (*File) Mode

func (ff *File) Mode() os.FileMode

Mode returns the file mode bits

func (*File) Name

func (ff *File) Name() string

Name returns the base name of the file

func (*File) Readdir

func (ff *File) Readdir(n int) ([]os.FileInfo, error)

Readdir reads the contents of the directory associated with file and returns a slice of up to n FileInfo values, as would be returned by Lstat, in directory order

func (*File) Size

func (ff *File) Size() int64

Size returns the length in bytes

func (*File) Sys

func (ff *File) Sys() interface{}

Sys returns the underlying File

type Filesystem

type Filesystem struct {
	sync.RWMutex // protects all File's entries
	// contains filtered or unexported fields
}

Filesystem implements Filesystem interface

func NewFilesystem

func NewFilesystem() *Filesystem

NewFilesystem creates a new Filesystem

func (*Filesystem) Mkdir

func (fs *Filesystem) Mkdir(name string, perm os.FileMode) error

Mkdir creates a new directory with the specified name and permission bits

func (*Filesystem) Open

func (fs *Filesystem) Open(name string) (filesystem.File, error)

Open opens the named file for reading

func (*Filesystem) ReadFile

func (fs *Filesystem) ReadFile(filename string) ([]byte, error)

ReadFile reads a file and returns the contents

func (*Filesystem) Stat

func (fs *Filesystem) Stat(name string) (os.FileInfo, error)

Stat returns a FileInfo describing the named file

func (*Filesystem) WriteFile

func (fs *Filesystem) WriteFile(filename string, data []byte, perm os.FileMode) error

WriteFile reads a file and returns the contents

Jump to

Keyboard shortcuts

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