Globals
- CommandLine
- Console
- Date
- Descriptor
- Environ
- EnvironEntry
- FileStat
- FileSystem
- Performance
- Process
- Random
- StringUtils
- Time
- WASIError
Ƭ aisize: i32
Defined in assembly/as-wasi.ts:55
▸ wasi_abort(message?
: string, fileName?
: string, lineNumber?
: u32, columnNumber?
: u32): void
Defined in assembly/as-wasi.ts:1102
Name | Type | Default value |
---|---|---|
message |
string | "" |
fileName |
string | "" |
lineNumber |
u32 | 0 |
columnNumber |
u32 | 0 |
Returns: void
Globals / CommandLine
- CommandLine
+ new CommandLine(): CommandLine
Defined in assembly/as-wasi.ts:989
Returns: CommandLine
• args: string[]
Defined in assembly/as-wasi.ts:989
• Static
get all(): Array<string>
Defined in assembly/as-wasi.ts:1018
Return all the command-line arguments
Returns: Array<string>
▸ all(): Array<string>
Defined in assembly/as-wasi.ts:1026
Return all the command-line arguments
Returns: Array<string>
▸ get(index
: usize): string | null
Defined in assembly/as-wasi.ts:1034
Return the i-th command-ine argument
Name | Type |
---|---|
index |
usize |
Returns: string | null
Globals / Console
- Console
▸ Static
error(s
: string, newline?
: bool): void
Defined in assembly/as-wasi.ts:857
Write an error to the console
Name | Type | Default value | Description |
---|---|---|---|
s |
string | - | string |
newline |
bool | true | false to avoid inserting a newline after the string |
Returns: void
▸ Static
log(s
: string): void
Defined in assembly/as-wasi.ts:848
Alias for Console.write()
Name | Type |
---|---|
s |
string |
Returns: void
▸ Static
readAll(): string | null
Defined in assembly/as-wasi.ts:834
Read an UTF8 string from the console, convert it to a native string
Returns: string | null
▸ Static
readLine(): string | null
Defined in assembly/as-wasi.ts:841
Read a line of text from the console, convert it from UTF8 to a native string
Returns: string | null
▸ Static
write(s
: string, newline?
: bool): void
Defined in assembly/as-wasi.ts:827
Write a string to the console
Name | Type | Default value | Description |
---|---|---|---|
s |
string | - | string |
newline |
bool | true | false to avoid inserting a newline after the string |
Returns: void
Globals / Date
- Date
▸ Static
now(): f64
Defined in assembly/as-wasi.ts:895
Return the current timestamp, as a number of milliseconds since the epoch
Returns: f64
Globals / Descriptor
A descriptor, that doesn't necessarily have to represent a file
- Descriptor
- advise
- allocate
- close
- dirName
- fatime
- fdatasync
- fileType
- fmtime
- fsync
- ftruncate
- futimes
- read
- readAll
- readLine
- readString
- seek
- setFlags
- stat
- tell
- touch
- write
- writeString
- writeStringLn
+ new Descriptor(rawfd
: fd): Descriptor
Defined in assembly/as-wasi.ts:109
Build a new descriptor from a raw WASI file descriptor
Name | Type | Description |
---|---|---|
rawfd |
fd | a raw file descriptor |
Returns: Descriptor
• get rawfd(): fd
Defined in assembly/as-wasi.ts:119
Returns: fd
• Static
get Invalid(): Descriptor
Defined in assembly/as-wasi.ts:94
An invalid file descriptor, that can represent an error
Returns: Descriptor
• Static
get Stderr(): Descriptor
Defined in assembly/as-wasi.ts:109
The standard error
Returns: Descriptor
• Static
get Stdin(): Descriptor
Defined in assembly/as-wasi.ts:99
The standard input
Returns: Descriptor
• Static
get Stdout(): Descriptor
Defined in assembly/as-wasi.ts:104
The standard output
Returns: Descriptor
▸ advise(offset
: u64, len
: u64, advice
: advice): bool
Defined in assembly/as-wasi.ts:130
Hint at how the data accessible via the descriptor will be used
offset
offset
len
length
advice
advice.{NORMAL, SEQUENTIAL, RANDOM, WILLNEED, DONTNEED, NOREUSE}
Name | Type |
---|---|
offset |
u64 |
len |
u64 |
advice |
advice |
Returns: bool
true
on success, false
on error
▸ allocate(offset
: u64, len
: u64): bool
Defined in assembly/as-wasi.ts:140
Preallocate data
Name | Type | Description |
---|---|---|
offset |
u64 | where to start preallocating data in the file |
len |
u64 | bytes to preallocate |
Returns: bool
true
on success, false
on error
▸ close(): void
Defined in assembly/as-wasi.ts:283
Close a file descriptor
Returns: void
▸ dirName(): string
Defined in assembly/as-wasi.ts:261
Return the directory associated to that descriptor
Returns: string
▸ fatime(ts
: f64): bool
Defined in assembly/as-wasi.ts:207
Update the access time
ts
timestamp in seconds
Name | Type |
---|---|
ts |
f64 |
Returns: bool
true
on success, false
on error
▸ fdatasync(): bool
Defined in assembly/as-wasi.ts:148
Wait for the data to be written
Returns: bool
true
on success, false
on error
▸ fileType(): filetype
Defined in assembly/as-wasi.ts:163
Return the file type
Returns: filetype
▸ fmtime(ts
: f64): bool
Defined in assembly/as-wasi.ts:219
Update the modification time
ts
timestamp in seconds
Name | Type |
---|---|
ts |
f64 |
Returns: bool
true
on success, false
on error
▸ fsync(): bool
Defined in assembly/as-wasi.ts:156
Wait for the data and metadata to be written
Returns: bool
true
on success, false
on error
▸ ftruncate(size?
: u64): bool
Defined in assembly/as-wasi.ts:198
Change the size of a file
Name | Type | Default value | Description |
---|---|---|---|
size |
u64 | 0 | new size |
Returns: bool
true
on success, false
on error
▸ futimes(atime
: f64, mtime
: f64): bool
Defined in assembly/as-wasi.ts:232
Update both the access and the modification times
atime
timestamp in seconds
mtime
timestamp in seconds
Name | Type |
---|---|
atime |
f64 |
mtime |
f64 |
Returns: bool
true
on success, false
on error
▸ read(data?
: u8[], chunk_size?
: usize): u8[] | null
Defined in assembly/as-wasi.ts:348
Read data from a file descriptor
Name | Type | Default value | Description |
---|---|---|---|
data |
u8[] | [] | existing array to push data to |
chunk_size |
usize | 4096 | chunk size (default: 4096) |
Returns: u8[] | null
▸ readAll(data?
: u8[], chunk_size?
: usize): u8[] | null
Defined in assembly/as-wasi.ts:378
Read from a file descriptor until the end of the stream
Name | Type | Default value | Description |
---|---|---|---|
data |
u8[] | [] | existing array to push data to |
chunk_size |
usize | 4096 | chunk size (default: 4096) |
Returns: u8[] | null
▸ readLine(): string | null
Defined in assembly/as-wasi.ts:411
Read a line of text from a file descriptor
Returns: string | null
▸ readString(chunk_size?
: usize): string | null
Defined in assembly/as-wasi.ts:450
Read an UTF8 string from a file descriptor, convert it to a native string
Name | Type | Default value | Description |
---|---|---|---|
chunk_size |
usize | 4096 | chunk size (default: 4096) |
Returns: string | null
▸ seek(off
: u64, w
: whence): bool
Defined in assembly/as-wasi.ts:464
Seek into a stream
off
offset
w
the position relative to which to set the offset of the file descriptor.
Name | Type |
---|---|
off |
u64 |
w |
whence |
Returns: bool
▸ setFlags(flags
: fdflags): bool
Defined in assembly/as-wasi.ts:177
Set WASI flags for that descriptor
params
flags: one or more of fdflags.{APPEND, DSYNC, NONBLOCK, RSYNC, SYNC}
Name | Type |
---|---|
flags |
fdflags |
Returns: bool
true
on success, false
on error
▸ stat(): FileStat
Defined in assembly/as-wasi.ts:185
Retrieve information about a descriptor
Returns: FileStat
a FileStat
object`
▸ tell(): u64
Defined in assembly/as-wasi.ts:475
Return the current offset in the stream
Returns: u64
offset
▸ touch(): bool
Defined in assembly/as-wasi.ts:247
Update the timestamp of the object represented by the descriptor
Returns: bool
true
on success, false
on error
▸ write(data
: u8[]): void
Defined in assembly/as-wasi.ts:291
Write data to a file descriptor
Name | Type | Description |
---|---|---|
data |
u8[] | data |
Returns: void
▸ writeString(s
: string, newline?
: bool): void
Defined in assembly/as-wasi.ts:309
Write a string to a file descriptor, after encoding it to UTF8
Name | Type | Default value | Description |
---|---|---|---|
s |
string | - | string |
newline |
bool | false | true to add a newline after the string |
Returns: void
▸ writeStringLn(s
: string): void
Defined in assembly/as-wasi.ts:328
Write a string to a file descriptor, after encoding it to UTF8, with a newline
Name | Type | Description |
---|---|---|
s |
string | string |
Returns: void
Globals / Environ
- Environ
+ new Environ(): Environ
Defined in assembly/as-wasi.ts:930
Returns: Environ
• env: Array<EnvironEntry>
Defined in assembly/as-wasi.ts:930
• Static
get all(): Array<EnvironEntry>
Defined in assembly/as-wasi.ts:960
Return all environment variables
Returns: Array<EnvironEntry>
▸ all(): Array<EnvironEntry>
Defined in assembly/as-wasi.ts:968
Return all environment variables
Returns: Array<EnvironEntry>
▸ get(key
: string): string | null
Defined in assembly/as-wasi.ts:976
Return the value for an environment variable
Name | Type | Description |
---|---|---|
key |
string | environment variable name |
Returns: string | null
Globals / EnvironEntry
- EnvironEntry
+ new EnvironEntry(key
: string, value
: string): EnvironEntry
Defined in assembly/as-wasi.ts:925
Name | Type |
---|---|
key |
string |
value |
string |
Returns: EnvironEntry
• Readonly
key: string
Defined in assembly/as-wasi.ts:926
• Readonly
value: string
Defined in assembly/as-wasi.ts:926
Globals / FileStat
Portable information about a file
- FileStat
+ new FileStat(st_buf
: usize): FileStat
Defined in assembly/as-wasi.ts:75
Name | Type |
---|---|
st_buf |
usize |
Returns: FileStat
• access_time: f64
Defined in assembly/as-wasi.ts:73
• creation_time: f64
Defined in assembly/as-wasi.ts:75
• file_size: filesize
Defined in assembly/as-wasi.ts:72
• file_type: filetype
Defined in assembly/as-wasi.ts:71
• modification_time: f64
Defined in assembly/as-wasi.ts:74
Globals / FileSystem
A class to access a filesystem
- FileSystem
▸ Static
Protected
dirfdForPath(path
: string): fd
Defined in assembly/as-wasi.ts:815
Name | Type |
---|---|
path |
string |
Returns: fd
▸ Static
exists(path
: string): bool
Defined in assembly/as-wasi.ts:579
Check if a file exists at a given path
path
path
Name | Type |
---|---|
path |
string |
Returns: bool
true
on success, false
on failure
▸ Static
link(old_path
: string, new_path
: string): bool
Defined in assembly/as-wasi.ts:602
Create a hard link
old_path
old path
new_path
new path
Name | Type |
---|---|
old_path |
string |
new_path |
string |
Returns: bool
true
on success, false
on failure
▸ Static
lstat(path
: string): FileStat
Defined in assembly/as-wasi.ts:718
Retrieve information about a file or a symbolic link
path
path
Name | Type |
---|---|
path |
string |
Returns: FileStat
a FileStat
object
▸ Static
mkdir(path
: string): bool
Defined in assembly/as-wasi.ts:562
Create a new directory
path
path
Name | Type |
---|---|
path |
string |
Returns: bool
true
on success, false
on failure
▸ Static
open(path
: string, flags?
: string): Descriptor | null
Defined in assembly/as-wasi.ts:495
Open a path
path
path
flags
r, r+, w, wx, w+ or xw+
Name | Type | Default value |
---|---|---|
path |
string | - |
flags |
string | "r" |
Returns: Descriptor | null
a descriptor
▸ Static
readdir(path
: string): Array<string> | null
Defined in assembly/as-wasi.ts:772
Get the content of a directory
Name | Type | Description |
---|---|---|
path |
string | the directory path |
Returns: Array<string> | null
An array of file names
▸ Static
rename(old_path
: string, new_path
: string): bool
Defined in assembly/as-wasi.ts:744
Rename a file
old_path
old path
new_path
new path
Name | Type |
---|---|
old_path |
string |
new_path |
string |
Returns: bool
true
on success, false
on failure
▸ Static
rmdir(path
: string): bool
Defined in assembly/as-wasi.ts:676
Remove a directory
path
path
Name | Type |
---|---|
path |
string |
Returns: bool
true
on success, false
on failure
▸ Static
stat(path
: string): FileStat
Defined in assembly/as-wasi.ts:693
Retrieve information about a file
path
path
Name | Type |
---|---|
path |
string |
Returns: FileStat
a FileStat
object
▸ Static
symlink(old_path
: string, new_path
: string): bool
Defined in assembly/as-wasi.ts:633
Create a symbolic link
old_path
old path
new_path
new path
Name | Type |
---|---|
old_path |
string |
new_path |
string |
Returns: bool
true
on success, false
on failure
▸ Static
unlink(path
: string): bool
Defined in assembly/as-wasi.ts:659
Unlink a file
path
path
Name | Type |
---|---|
path |
string |
Returns: bool
true
on success, false
on failure
Globals / Performance
- Performance
▸ Static
now(): f64
Defined in assembly/as-wasi.ts:905
Returns: f64
Globals / Process
- Process
▸ Static
exit(status
: u32): void
Defined in assembly/as-wasi.ts:920
Cleanly terminate the current process
Name | Type | Description |
---|---|---|
status |
u32 | exit code |
Returns: void
Globals / Random
- Random
▸ Static
randomBytes(len
: usize): Uint8Array
Defined in assembly/as-wasi.ts:884
Return an array of random bytes
Name | Type | Description |
---|---|---|
len |
usize | length |
Returns: Uint8Array
▸ Static
randomFill(buffer
: ArrayBuffer): void
Defined in assembly/as-wasi.ts:867
Fill a buffer with random data
Name | Type | Description |
---|---|---|
buffer |
ArrayBuffer | An array buffer |
Returns: void
Globals / StringUtils
- StringUtils
▸ Static
fromCString(cstring
: usize): string
Defined in assembly/as-wasi.ts:1091
Returns a native string from a zero-terminated C string
Name | Type |
---|---|
cstring |
usize |
Returns: string
native string
Globals / Time
- Time
▪ Static
MILLISECOND: i32 = Time.NANOSECOND * 1000000
Defined in assembly/as-wasi.ts:1046
▪ Static
NANOSECOND: i32 = 1
Defined in assembly/as-wasi.ts:1045
▪ Static
SECOND: i32 = Time.MILLISECOND * 1000
Defined in assembly/as-wasi.ts:1047
▸ Static
sleep(nanoseconds
: i32): void
Defined in assembly/as-wasi.ts:1051
Name | Type |
---|---|
nanoseconds |
i32 |
Returns: void
Globals / WASIError
A WASI error
-
Error
↳ WASIError
+ new WASIError(message?
: string): WASIError
Overrides void
Defined in assembly/as-wasi.ts:60
Name | Type | Default value |
---|---|---|
message |
string | "" |
Returns: WASIError
• message: string
Inherited from WASIError.message
Defined in node_modules/assemblyscript/std/assembly/index.d.ts:1718
Message provided on construction.
• name: string
Defined in node_modules/assemblyscript/std/assembly/index.d.ts:1715
Error name.
• Optional
stack: undefined | string
Inherited from WASIError.stack
Defined in node_modules/assemblyscript/std/assembly/index.d.ts:1721
Stack trace.
▸ toString(): string
Inherited from WASIError.toString
Defined in node_modules/assemblyscript/std/assembly/index.d.ts:1727
Method returns a string representing the specified Error class.
Returns: string