file

File input and output operations

Import

_ <- fat.file

Methods

Name Signature Brief
basePath (): Text Extract path where app was called
exists (path: Text): Boolean Check file exists on provided path
read (path: Text): Text Read file from path (text mode)
write (path: Text, src): Boolean Write src to file and return success
append (path: Text, src): Boolean Append to file and return success
isDir (path: Text): Boolean Check if path is a directory
lsDir (path: Text): List Get list of files in a directory

currently only text mode is supported (binary mode is not supported), but there is a proposal to add support for it in the future

Usage Notes

read

On exception:

  • logs error to stderr
  • returns null

read cannot see builtin "files", but readLib from sdk lib can

write/append

Exceptions:

  • logs error to stderr
  • returns false

See also

results matching ""

    No results matching ""