fs

package
v0.0.0-...-a2b917b Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ENOENT    = "ENOENT"
	ENOACCESS = "ENOACCESS"
)
View Source
const (
	F_OK = 1
	R_OK = 2
	W_OK = 4
	X_OK = 8
)

Variables

View Source
var ErrFileDescriptorNotFound = func(ctx context.Context) error { return NewFSError(ctx, "ENOFD", "file descriptor not found") }
View Source
var ErrInvalid = func(ctx context.Context) error { return NewFSError(ctx, "EINVAL", "received invalid argument") }
View Source
var ErrNoFileDescriptorTable = func(ctx context.Context) error {
	return NewFSError(ctx, "ENOCTX", "file descriptor table not found in context")
}

Functions

func IsNotExists

func IsNotExists(err error) bool

func NewEmbedFS

func NewEmbedFS(embed *embed.FS) *embedfs

func NewFS

func NewFS() *fs

func NewHttpFS

func NewHttpFS(url url.URL) *httpfs

func NewLocalFS

func NewLocalFS(path string) *localfs

Types

type DirEntry

type DirEntry interface {
	IsFile() bool
	IsDirectory() bool
	Name() string
}

type FS

type FS interface {
	ReadDir(ctx context.Context, path string) ([]string, error)
	ReadFile(ctx context.Context, path string, options ...any) (any, error)
	ReadStream(ctx context.Context, path string) (ReadStream, error)
	Open(ctx context.Context, path string) (FileDescriptor, error)
	Close(ctx context.Context, fd FileDescriptor) error
	Exists(ctx context.Context, path string) (bool, error)
	Stat(ctx context.Context, path string) (Stats, error)
	LStat(ctx context.Context, path string) (Stats, error)
	Access(ctx context.Context, path string, args ...any) error
	Mount(mountPoint string, mount FS, path string) error
	RealPath(ctx context.Context, path string) (string, error)
	File(ctx context.Context, fd FileDescriptor) (File, error)
}

type FSError

type FSError interface {
	isolates.Error
	Code() string
}

type FSErrorBase

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

func NewFSError

func NewFSError(ctx context.Context, code string, message string) *FSErrorBase

func NewFSError2

func NewFSError2(in isolates.FunctionArgs) (*FSErrorBase, error)

func (*FSErrorBase) Code

func (e *FSErrorBase) Code() string

func (*FSErrorBase) Error

func (e *FSErrorBase) Error() string

func (*FSErrorBase) Message

func (e *FSErrorBase) Message() string

func (*FSErrorBase) V8GetCode

func (e *FSErrorBase) V8GetCode(in isolates.GetterArgs) (*isolates.Value, error)

func (*FSErrorBase) V8GetMessage

func (e *FSErrorBase) V8GetMessage(in isolates.GetterArgs) (*isolates.Value, error)

type File

type File interface {
	Close(ctx context.Context) error
	ReadStream(ctx context.Context) (ReadStream, error)
	ReadAll(ctx context.Context) ([]byte, error)
}

type FileDescriptor

type FileDescriptor uintptr

func NewFileDescriptor

func NewFileDescriptor(ctx context.Context, file File) (FileDescriptor, error)

func (FileDescriptor) Close

func (f FileDescriptor) Close(ctx context.Context) error

func (FileDescriptor) File

func (f FileDescriptor) File(ctx context.Context) (File, error)

func (FileDescriptor) ReadAll

func (f FileDescriptor) ReadAll(ctx context.Context) ([]byte, error)

func (FileDescriptor) ReadStream

func (f FileDescriptor) ReadStream(ctx context.Context) (ReadStream, error)

type FileMode

type FileMode gofs.FileMode

type ReadStream

type ReadStream interface {
	stream.Readable
}

type ReadStreamBase

type ReadStreamBase struct {
	*stream.ReadableBase
}

func NewReadStream

func NewReadStream(in isolates.FunctionArgs) (*ReadStreamBase, error)

type Stats

type Stats interface {
	IsFile() bool
	IsDirectory() bool
	IsSymbolicLink() bool
	AccessedMilli() int64
	Accessed() time.Time
	ModifiedMilli() int64
	Modified() time.Time
	ChangedMilli() int64
	Changed() time.Time
	CreatedMilli() int64
	Created() time.Time
	Size() int64
	ContentType() string
	Uid() int
	Gid() int
	Mode() FileMode
}

Jump to

Keyboard shortcuts

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