Documentation ¶
Overview ¶
Package sys provides platform-independent interfaces to support webassembly runtime
Index ¶
- Variables
- type DiskFS
- func (dfs *DiskFS) MkdirAll(path string, perm os.FileMode) error
- func (dfs *DiskFS) Open(name string) (File, error)
- func (dfs *DiskFS) OpenFile(name string, flag int, perm os.FileMode) (File, error)
- func (dfs *DiskFS) ReadFile(name string) ([]byte, error)
- func (dfs *DiskFS) Remove(name string) error
- func (dfs *DiskFS) Stat(name string) (fs.FileInfo, error)
- func (dfs *DiskFS) WriteFile(name string, data []byte, perm os.FileMode) error
- type FS
- type File
- type KeyPair
- type MemChanFS
- func (mfs *MemChanFS) MkdirAll(path string, perm os.FileMode) error
- func (mfs *MemChanFS) Open(name string) (File, error)
- func (mfs *MemChanFS) OpenFile(name string, flag int, perm os.FileMode) (File, error)
- func (mfs *MemChanFS) ReadFile(name string) ([]byte, error)
- func (mfs *MemChanFS) Remove(name string) error
- func (mfs *MemChanFS) Stat(name string) (fs.FileInfo, error)
- func (mfs *MemChanFS) WriteFile(name string, data []byte, perm os.FileMode) error
- type MemChanFile
- func (f *MemChanFile) Close() error
- func (f *MemChanFile) Read(p []byte) (int, error)
- func (f *MemChanFile) Seek(offset int64, whence int) (ret int64, err error)
- func (f *MemChanFile) Stat() (fs.FileInfo, error)
- func (f *MemChanFile) Sync() error
- func (f *MemChanFile) Write(p []byte) (n int, err error)
- type MemFS
- func (mfs *MemFS) MkdirAll(path string, perm os.FileMode) error
- func (mfs *MemFS) Open(name string) (File, error)
- func (mfs *MemFS) OpenFile(name string, flag int, perm os.FileMode) (File, error)
- func (mfs *MemFS) ReadFile(name string) ([]byte, error)
- func (mfs *MemFS) Remove(name string) error
- func (mfs *MemFS) Stat(name string) (fs.FileInfo, error)
- func (mfs *MemFS) WriteFile(name string, data []byte, perm os.FileMode) error
- type MemFile
- type MemFileChanInfo
- func (i *MemFileChanInfo) Info() (fs.FileInfo, error)
- func (i *MemFileChanInfo) IsDir() bool
- func (i *MemFileChanInfo) ModTime() time.Time
- func (i *MemFileChanInfo) Mode() fs.FileMode
- func (i *MemFileChanInfo) Name() string
- func (i *MemFileChanInfo) Size() int64
- func (i *MemFileChanInfo) Sys() interface{}
- func (i *MemFileChanInfo) Type() fs.FileMode
- type MemFileInfo
- func (i *MemFileInfo) Info() (fs.FileInfo, error)
- func (i *MemFileInfo) IsDir() bool
- func (i *MemFileInfo) ModTime() time.Time
- func (i *MemFileInfo) Mode() fs.FileMode
- func (i *MemFileInfo) Name() string
- func (i *MemFileInfo) Size() int64
- func (i *MemFileInfo) Sys() interface{}
- func (i *MemFileInfo) Type() fs.FileMode
- type SignFunc
- type VerifyFunc
- type VerifyWithFunc
Constants ¶
This section is empty.
Variables ¶
var ( //Files file system implementation on sdk. DiskFS doesn't work on webassembly. it should be initialized with common.NewMemFS() Files FS = NewDiskFS() //Sleep pauses the current goroutine for at least the duration. // time.Sleep will stop webassembly main thread. it should be bridged to javascript method on webassembly sdk Sleep = time.Sleep // Sign sign method. it should be initialized on different platform. Sign SignFunc // Verify verify method. it should be initialized on different platform. Verify VerifyFunc // Verify verify method. it should be initialized on different platform. VerifyWith VerifyWithFunc )
Functions ¶
This section is empty.
Types ¶
type DiskFS ¶
type DiskFS struct { }
DiskFS implement file system on disk
func (*DiskFS) Open ¶
Open opens the named file for reading. If successful, methods on the returned file can be used for reading; the associated file descriptor has mode O_RDONLY. If there is an error, it will be of type *PathError.
func (*DiskFS) Remove ¶
Remove removes the named file or (empty) directory. If there is an error, it will be of type *PathError.
type FS ¶
type FS interface { // Open opens the named file for reading. If successful, methods on // the returned file can be used for reading; the associated file // descriptor has mode O_RDONLY. // If there is an error, it will be of type *PathError. Open(name string) (File, error) // OpenFile open a file OpenFile(name string, flag int, perm os.FileMode) (File, error) // ReadFile reads the file named by filename and returns the contents. ReadFile(name string) ([]byte, error) // WriteFile writes data to a file named by filename. WriteFile(name string, data []byte, perm fs.FileMode) error Stat(name string) (fs.FileInfo, error) // Remove removes the named file or (empty) directory. // If there is an error, it will be of type *PathError. Remove(name string) error //MkdirAll creates a directory named path MkdirAll(path string, perm os.FileMode) error }
FS An FS provides access to a hierarchical file system.
type MemChanFS ¶ added in v1.8.17
type MemChanFS struct {
// contains filtered or unexported fields
}
MemFS implement file system on memory
func (*MemChanFS) Open ¶ added in v1.8.17
Open opens the named file for reading. If successful, methods on the returned file can be used for reading; the associated file descriptor has mode O_RDONLY. If there is an error, it will be of type *PathError.
func (*MemChanFS) ReadFile ¶ added in v1.8.17
ReadFile reads the file named by filename and returns the contents.
func (*MemChanFS) Remove ¶ added in v1.8.17
Remove removes the named file or (empty) directory. If there is an error, it will be of type *PathError.
type MemChanFile ¶ added in v1.8.17
type MemChanFile struct { Name string Buffer chan []byte // file content Mode fs.FileMode // FileInfo.Mode ModTime time.Time // FileInfo.ModTime ChunkWriteSize int // 0 value means no limit Sys interface{} // FileInfo.Sys // contains filtered or unexported fields }
func (*MemChanFile) Close ¶ added in v1.8.17
func (f *MemChanFile) Close() error
func (*MemChanFile) Seek ¶ added in v1.8.17
func (f *MemChanFile) Seek(offset int64, whence int) (ret int64, err error)
func (*MemChanFile) Sync ¶ added in v1.8.17
func (f *MemChanFile) Sync() error
type MemFS ¶
type MemFS struct {
// contains filtered or unexported fields
}
MemFS implement file system on memory
func (*MemFS) Open ¶
Open opens the named file for reading. If successful, methods on the returned file can be used for reading; the associated file descriptor has mode O_RDONLY. If there is an error, it will be of type *PathError.
func (*MemFS) Remove ¶
Remove removes the named file or (empty) directory. If there is an error, it will be of type *PathError.
type MemFile ¶
type MemFileChanInfo ¶ added in v1.8.17
type MemFileChanInfo struct {
// contains filtered or unexported fields
}
func (*MemFileChanInfo) Info ¶ added in v1.8.17
func (i *MemFileChanInfo) Info() (fs.FileInfo, error)
func (*MemFileChanInfo) IsDir ¶ added in v1.8.17
func (i *MemFileChanInfo) IsDir() bool
func (*MemFileChanInfo) ModTime ¶ added in v1.8.17
func (i *MemFileChanInfo) ModTime() time.Time
func (*MemFileChanInfo) Mode ¶ added in v1.8.17
func (i *MemFileChanInfo) Mode() fs.FileMode
func (*MemFileChanInfo) Name ¶ added in v1.8.17
func (i *MemFileChanInfo) Name() string
func (*MemFileChanInfo) Size ¶ added in v1.8.17
func (i *MemFileChanInfo) Size() int64
func (*MemFileChanInfo) Sys ¶ added in v1.8.17
func (i *MemFileChanInfo) Sys() interface{}
func (*MemFileChanInfo) Type ¶ added in v1.8.17
func (i *MemFileChanInfo) Type() fs.FileMode
type MemFileInfo ¶
type MemFileInfo struct {
// contains filtered or unexported fields
}
func (*MemFileInfo) IsDir ¶
func (i *MemFileInfo) IsDir() bool
func (*MemFileInfo) ModTime ¶
func (i *MemFileInfo) ModTime() time.Time
func (*MemFileInfo) Mode ¶
func (i *MemFileInfo) Mode() fs.FileMode
func (*MemFileInfo) Name ¶
func (i *MemFileInfo) Name() string
func (*MemFileInfo) Size ¶
func (i *MemFileInfo) Size() int64
func (*MemFileInfo) Sys ¶
func (i *MemFileInfo) Sys() interface{}
func (*MemFileInfo) Type ¶
func (i *MemFileInfo) Type() fs.FileMode