compiler/shared/l0/stdlib/std/fs.l0
Module std.fs
Overview Symbols grouped by source file: compiler/shared/l0/stdlib/std/fs.l0
Module: std.fs
Source: compiler/shared/l0/stdlib/std/fs.l0 Language: Dea/L0
Imports / Includes
std.unitsys.rt
Symbols
- _fs_from_rt
- stat
- exists
- is_file
- is_dir
- file_size
- mtime_sec
- delete_file
- read_file
- write_file
- FileInfo
Function _fs_from_rt
func _fs_from_rt(info: RtFileInfo) -> FileInfo
Convert one runtime metadata record into the public stdlib wrapper type.
Parameters:
info: Runtime metadata record.
Returns: Public stdlib metadata record.
Function stat
func stat(path: string) -> FileInfo
Return metadata for a filesystem path.
Parameters:
path: Filesystem path to inspect.
Returns: Metadata record with nullable size and timestamp fields.
Function exists
func exists(path: string) -> bool
Return whether any filesystem object exists at a path.
Parameters:
path: Filesystem path to inspect.
Returns: true when the path exists.
Function is_file
func is_file(path: string) -> bool
Return whether a path exists and is a regular file.
Parameters:
path: Filesystem path to inspect.
Returns: true when path is a file.
Function is_dir
func is_dir(path: string) -> bool
Return whether a path exists and is a directory.
Parameters:
path: Filesystem path to inspect.
Returns: true when path is a directory.
Function file_size
func file_size(path: string) -> int?
Return the size of a file when available.
Parameters:
path: Filesystem path to inspect.
Returns: File size in bytes, or null when unavailable.
Function mtime_sec
func mtime_sec(path: string) -> int?
Return the modification time in whole seconds when available.
Parameters:
path: Filesystem path to inspect.
Returns: Unix modification time in seconds, or null when unavailable.
Function delete_file
func delete_file(path: string) -> Unit?
Delete the file at the given path.
Parameters:
path: File path to remove.
Returns: present() on success, or null on error.
Function read_file
func read_file(path: string) -> string?
Read the entire content of a file.
Parameters:
path: File path to read.
Returns: File contents, or null on error.
Function write_file
func write_file(path: string, data: string) -> Unit?
Write the entire content of a file.
Parameters:
path: File path to write.data: String content to write.
Returns: present() on success, or null on error.
Struct FileInfo
Shared file metadata wrapper around sys.rt::RtFileInfo .
FileInfo Field exists
exists: bool
FileInfo Field is_file
is_file: bool
FileInfo Field is_dir
is_dir: bool
FileInfo Field size
size: int?
FileInfo Field mtime_sec
mtime_sec: int?
FileInfo Field mtime_nsec
mtime_nsec: int?