fs

package
Version: v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2021 License: Apache-2.0, MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dir

type Dir struct {
	// contains filtered or unexported fields
}

func NewDir

func NewDir(name string, files []fs.File) *Dir

NewDir creates a new fs.File compatible "directory" from the passed slice of fs.File.

It implements fs.ReadDir and directory entries returned implement Opener, allowing access to the underlying files passed here.

You can add nested directories (of the same type) to this directory. Adding filesystem directories to this directory is NOT supported.

func (*Dir) Close

func (d *Dir) Close() error

func (*Dir) Read

func (d *Dir) Read([]byte) (int, error)

func (*Dir) ReadDir

func (d *Dir) ReadDir(n int) ([]fs.DirEntry, error)

ReadDir reads the contents of the directory and returns a slice of up to n DirEntry values in directory order.

func (*Dir) Stat

func (d *Dir) Stat() (fs.FileInfo, error)

type DirEntry

type DirEntry struct {
	// contains filtered or unexported fields
}

func (*DirEntry) Info

func (de *DirEntry) Info() (fs.FileInfo, error)

func (*DirEntry) IsDir

func (de *DirEntry) IsDir() bool

func (*DirEntry) Name

func (de *DirEntry) Name() string

func (*DirEntry) Open

func (de *DirEntry) Open() (fs.File, error)

func (*DirEntry) Type

func (de *DirEntry) Type() fs.FileMode

type DirInfo

type DirInfo struct {
	// contains filtered or unexported fields
}

func (*DirInfo) IsDir

func (di *DirInfo) IsDir() bool

func (*DirInfo) ModTime

func (di *DirInfo) ModTime() time.Time

func (*DirInfo) Mode

func (di *DirInfo) Mode() fs.FileMode

func (*DirInfo) Name

func (di *DirInfo) Name() string

func (*DirInfo) Size

func (di *DirInfo) Size() int64

func (*DirInfo) Sys

func (di *DirInfo) Sys() interface{}

type Opener

type Opener interface {
	Open() (fs.File, error)
}

type OsFs

type OsFs struct{}

OsFs is an implementation of fs.FS backed by os.

func (*OsFs) Open

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

func (*OsFs) ReadDir

func (fs *OsFs) ReadDir(name string) ([]fs.DirEntry, error)

func (*OsFs) ReadFile

func (fs *OsFs) ReadFile(name string) ([]byte, error)

func (*OsFs) Stat

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

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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