Return the next byte from the file. Return -1 if the end of file is
reached.
Returns number
getline
getline(): string
Return the next line from the file, assuming UTF-8 encoding, excluding
the trailing line feed.
Returns string
printf
printf(format: string, ...args: any[]): number
Formatted printf.
The same formats as the standard C library printf are supported.
Integer format types (e.g. %d) truncate the Numbers or BigInts to 32
bits. Use the l modifier (e.g. %ld) to truncate to 64 bits.
Parameters
format: string
Rest...args: any[]
Returns number
putByte
putByte(c: number): number
Write one byte to the file.
Parameters
c: number
Returns number
puts
puts(str: string): void
Outputs the string with the UTF-8 encoding.
Parameters
str: string
Returns void
read
read(buffer: ArrayBuffer, position: number, length: number): number
Read length bytes from the file to the ArrayBuffer buffer at
byte position position (wrapper to the libc fread).
Parameters
buffer: ArrayBuffer
position: number
length: number
Returns number
readAsString
readAsString(max_size?: number): string
Read max_size bytes from the file and return them as a string
assuming UTF-8 encoding. If max_size is not present, the file is
read up its end.
Parameters
Optional max_size: number
Returns string
seek
seek(offset: number, whence: number): number
Seek to a give file position (whence is std.SEEK_*). offset can
be a number or a bigint. Return 0 if OK or -errno in case of I/O
error.
Parameters
offset: number
whence: number
Returns number
tell
tell(): number
Return the current file position.
Returns number
tello
tello(): bigint
Return the current file position as a bigint.
Returns bigint
write
write(buffer: ArrayBuffer, postion: number, length: number): number
Write length bytes to the file from the ArrayBuffer buffer at
byte position position (wrapper to the libc fwrite).
FILE prototype