File systemReference
readfile
Read all bytes from a workspace file.
Details#
Read all bytes from a workspace file. Binary file contents, including embedded NUL bytes. Missing files, folders and read failures cause an error.
Signature#
readfile(path: string): stringParameters#
| Parameter | Type | Description |
|---|---|---|
path | string | UTF-8 path relative to the application's workspace. |
Returns#
Binary file contents, including embedded NUL bytes. Missing files, folders and read failures cause an error.
Examples#
Local example
writefile("docs-example/note.txt", "Hello")
print(readfile("docs-example/note.txt")) -- Hello