opfs

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Rendered for js/wasm

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Await

func Await(p js.Value) (js.Value, error)

A helper function which makes async calls to JS API synchronous.

An example of what this does:

FileSystemDirectoryHandle.removeEntry(name).then(() => {
	// something
}).catch(() => {
	// something
});

But instead of "something", we pass the value/error to Go.

Types

type OPFS

type OPFS struct {
	RootHandle js.Value // FileSystemDirectoryHandle
}

Origin private file system

https://developer.mozilla.org/en-US/docs/Web/API/File_System_API/Origin_private_file_system

func New

func New(baseDirHandle js.Value) *OPFS

func (*OPFS) Chroot

func (fs *OPFS) Chroot(path string) (billy.Filesystem, error)

func (*OPFS) Create

func (fs *OPFS) Create(name string) (billy.File, error)

func (*OPFS) Join

func (fs *OPFS) Join(elem ...string) string

func (*OPFS) Lstat

func (fs *OPFS) Lstat(filename string) (fs.FileInfo, error)

func (*OPFS) MkdirAll

func (fs *OPFS) MkdirAll(path string, perm fs.FileMode) error

func (*OPFS) Open

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

func (*OPFS) OpenFile

func (fs *OPFS) OpenFile(fullPath string, flag int, perm os.FileMode) (billy.File, error)

func (*OPFS) ReadDir

func (fs *OPFS) ReadDir(path string) (infos []os.FileInfo, err error)
func (fs *OPFS) Readlink(link string) (string, error)

func (*OPFS) Remove

func (fs *OPFS) Remove(path string) error

func (*OPFS) Rename

func (fs *OPFS) Rename(oldpath, newpath string) error

func (*OPFS) Root

func (fs *OPFS) Root() string

func (*OPFS) Stat

func (fs *OPFS) Stat(path string) (os.FileInfo, error)
func (fs *OPFS) Symlink(target, link string) error

func (*OPFS) TempFile

func (fs *OPFS) TempFile(dir string, prefix string) (billy.File, error)

type OPFSFile

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

This struct represents a file in our OPFS FileSystem, but there can by multiple instances of the single file, with different offsets, pointing at the same inode (aka. the REAL file)

func (*OPFSFile) Close

func (f *OPFSFile) Close() error

func (*OPFSFile) Lock

func (f *OPFSFile) Lock() error

func (*OPFSFile) Name

func (f *OPFSFile) Name() (name string)

func (*OPFSFile) Read

func (f *OPFSFile) Read(p []byte) (int, error)

func (*OPFSFile) ReadAt

func (f *OPFSFile) ReadAt(p []byte, off int64) (n int, err error)

func (*OPFSFile) Seek

func (f *OPFSFile) Seek(offset int64, whence int) (newOffset int64, err error)

func (*OPFSFile) Truncate

func (f *OPFSFile) Truncate(size int64) error

func (*OPFSFile) Unlock

func (f *OPFSFile) Unlock() error

func (*OPFSFile) Write

func (f *OPFSFile) Write(p []byte) (int, error)

func (*OPFSFile) WriteAt

func (f *OPFSFile) WriteAt(p []byte, off int64) (n int, err error)

type OPFSFileInfo

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

func (*OPFSFileInfo) Info

func (fi *OPFSFileInfo) Info() (fs.FileInfo, error)

func (*OPFSFileInfo) IsDir

func (fi *OPFSFileInfo) IsDir() bool

func (*OPFSFileInfo) ModTime

func (fi *OPFSFileInfo) ModTime() time.Time

func (*OPFSFileInfo) Mode

func (fi *OPFSFileInfo) Mode() os.FileMode

Mode returns the file permissions. Git checks this to see if a file is executable or a directory.

func (*OPFSFileInfo) Name

func (fi *OPFSFileInfo) Name() string

func (*OPFSFileInfo) Size

func (fi *OPFSFileInfo) Size() int64

func (*OPFSFileInfo) Sys

func (fi *OPFSFileInfo) Sys() any

func (*OPFSFileInfo) Type

func (fi *OPFSFileInfo) Type() fs.FileMode

Jump to

Keyboard shortcuts

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