About

Get Started

Docs

fs

import "github.com/gosolid/solid/pkg/runtime/fs"

Index

Constants

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

Variables

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

func IsNotExists

func IsNotExists(err error) bool

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) ([]byte, 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
}

Up next

http