fs

package
v1.1.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

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

func New

func New(runtime *bridge.Runtime, root, cwd string, extraRoots []string, allowAllFileAccess bool) (*Module, error)

New creates the filesystem module confined to root (BaseDir) plus any extra roots. When allowAllFileAccess is true every root is opened but ignored so paths resolve against the real filesystem.

func (*Module) Chdir

func (m *Module) Chdir(name string) error

func (*Module) Close

func (m *Module) Close()

func (*Module) Cwd

func (m *Module) Cwd() string

func (*Module) Load

func (m *Module) Load(vm *goja.Runtime, module *goja.Object)

func (*Module) OpenFileCount

func (m *Module) OpenFileCount() int

func (*Module) ReadSource

func (m *Module) ReadSource(name string) ([]byte, error)

ReadSource loads a CommonJS source file through the same rooted filesystem handle used by fs, preventing path validation and file opening from racing.

func (*Module) Resolve

func (m *Module) Resolve(name string, allowMissing bool) (string, error)

func (*Module) SetExternalFileLookup

func (m *Module) SetExternalFileLookup(lookup func(int) (*os.File, bool))

func (*Module) SetFileHooks

func (m *Module) SetFileHooks(onOpen func(int, *os.File, uint64), onClose func(int))

func (*Module) WriteResolved

func (m *Module) WriteResolved(path string, data []byte, mode os.FileMode) error

Jump to

Keyboard shortcuts

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