Module
Module documentation.
modulefs
Classes
Classes and inheritance.
classfs::FileInfo
@brief`FileInfo` type.
@details`FileInfo` encapsulates state and operations exported by the system module. It commonly stores runtime handles, protocol state, buffers, configuration, or collection data. Its methods define the primary behavior for the type. If the type owns external resources, prefer `dispose` or `close` for deterministic release.
class FileInfo {
/*
@brief `name` field.classfs::File
@brief`File` type.
@details`File` encapsulates state and operations exported by the system module. It commonly stores runtime handles, protocol state, buffers, configuration, or collection data. Its methods define the primary behavior for the type. If the type owns external resources, prefer `dispose` or `close` for deterministic release.
class FileInfo {
/*
@brief `name` field.classfs::Stream
@brief`Stream` type.
@details`Stream` encapsulates state and operations exported by the system module. It commonly stores runtime handles, protocol state, buffers, configuration, or collection data. Its methods define the primary behavior for the type. If the type owns external resources, prefer `dispose` or `close` for deterministic release.
class Stream {
/*
@brief `h` field.Functions
Free functions and class methods.
functionfs::__file_exists
Signature
extern func __file_exists(path: String) -> Int;extern func __file_exists(path: String) -> Int;
/*
@brief Binds the low-level runtime symbol `__file_remove`.@briefBinds the low-level runtime symbol `__file_exists`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- pathFile or directory path.
@returnReturns the operation result as `Int`.
functionfs::__file_remove
Signature
extern func __file_remove(path: String) -> Int;extern func __file_remove(path: String) -> Int;
/*
@brief Binds the low-level runtime symbol `__file_write_text`.@briefBinds the low-level runtime symbol `__file_remove`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- pathFile or directory path.
@returnReturns the operation result as `Int`.
functionfs::__file_write_text
Signature
extern func __file_write_text(path: String, data: String) -> Int;extern func __file_write_text(path: String, data: String) -> Int;
/*
@brief Binds the low-level runtime symbol `__file_read_text`.@briefBinds the low-level runtime symbol `__file_write_text`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- pathFile or directory path.
- dataInput or output data buffer.
@returnReturns the operation result as `Int`.
functionfs::__file_read_text
Signature
extern func __file_read_text(path: String) -> String;extern func __file_read_text(path: String) -> String;
/*
@brief Binds the low-level runtime symbol `__file_read_bytes`.@briefBinds the low-level runtime symbol `__file_read_text`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- pathFile or directory path.
@returnReturns the operation result as `String`.
functionfs::__file_read_bytes
Signature
extern func __file_read_bytes(path: String, max_bytes: Int) -> String;extern func __file_read_bytes(path: String, max_bytes: Int) -> String;
/*
@brief Binds the low-level runtime symbol `__file_write_bytes`.@briefBinds the low-level runtime symbol `__file_read_bytes`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- pathFile or directory path.
- max_bytesMaximum number of bytes to read or process in this operation.
@returnReturns the operation result as `String`.
functionfs::__file_write_bytes
Signature
extern func __file_write_bytes(path: String, data: String) -> Int;extern func __file_write_bytes(path: String, data: String) -> Int;
/*
@brief Binds the low-level runtime symbol `__file_read_path_at`.@briefBinds the low-level runtime symbol `__file_write_bytes`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- pathFile or directory path.
- dataInput or output data buffer.
@returnReturns the operation result as `Int`.
functionfs::__file_read_path_at
Signature
extern func __file_read_path_at(path: String, offset: Int, max_bytes: Int) -> String;extern func __file_read_path_at(path: String, offset: Int, max_bytes: Int) -> String;
/*
@brief Binds the low-level runtime symbol `__file_write_path_at`.@briefBinds the low-level runtime symbol `__file_read_path_at`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- pathFile or directory path.
- offsetByte offset measured from the start position.
- max_bytesMaximum number of bytes to read or process in this operation.
@returnReturns the operation result as `String`.
functionfs::__file_write_path_at
Signature
extern func __file_write_path_at(path: String, offset: Int, data: String) -> Int;extern func __file_write_path_at(path: String, offset: Int, data: String) -> Int;
/*
@brief Binds the low-level runtime symbol `__file_open`.@briefBinds the low-level runtime symbol `__file_write_path_at`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- pathFile or directory path.
- offsetByte offset measured from the start position.
- dataInput or output data buffer.
@returnReturns the operation result as `Int`.
functionfs::__file_open
Signature
extern func __file_open(path: String, flags: Int, mode: Int) -> Int;extern func __file_open(path: String, flags: Int, mode: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__file_handle_read_at`.@briefBinds the low-level runtime symbol `__file_open`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- pathFile or directory path.
- flagsBitmask of option flags that controls how the operation is performed.
- modeMode value that selects permissions, behavior, or formatting rules for the operation.
@returnReturns the operation result as `Int`.
functionfs::__file_handle_read_at
Signature
extern func __file_handle_read_at(h: Int, offset: Int, max_bytes: Int) -> String;extern func __file_handle_read_at(h: Int, offset: Int, max_bytes: Int) -> String;
/*
@brief Binds the low-level runtime symbol `__file_handle_write_at`.@briefBinds the low-level runtime symbol `__file_handle_read_at`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- hUnderlying runtime handle.
- offsetByte offset measured from the start position.
- max_bytesMaximum number of bytes to read or process in this operation.
@returnReturns the operation result as `String`.
functionfs::__file_handle_write_at
Signature
extern func __file_handle_write_at(h: Int, offset: Int, data: String) -> Int;extern func __file_handle_write_at(h: Int, offset: Int, data: String) -> Int;
/*
@brief Binds the low-level runtime symbol `__file_handle_read_raw`.@briefBinds the low-level runtime symbol `__file_handle_write_at`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- hUnderlying runtime handle.
- offsetByte offset measured from the start position.
- dataInput or output data buffer.
@returnReturns the operation result as `Int`.
functionfs::__file_handle_read_raw
Signature
extern func __file_handle_read_raw(h: Int, max_bytes: Int) -> String;extern func __file_handle_read_raw(h: Int, max_bytes: Int) -> String;
/*
@brief Binds the low-level runtime symbol `__file_handle_write_raw`.@briefBinds the low-level runtime symbol `__file_handle_read_raw`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- hUnderlying runtime handle.
- max_bytesMaximum number of bytes to read or process in this operation.
@returnReturns the operation result as `String`.
functionfs::__file_handle_write_raw
Signature
extern func __file_handle_write_raw(h: Int, data: String) -> Int;extern func __file_handle_write_raw(h: Int, data: String) -> Int;
/*
@brief Binds the low-level runtime symbol `__file_handle_set_nonblock`.@briefBinds the low-level runtime symbol `__file_handle_write_raw`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- hUnderlying runtime handle.
- dataInput or output data buffer.
@returnReturns the operation result as `Int`.
functionfs::__file_handle_set_nonblock
Signature
extern func __file_handle_set_nonblock(h: Int) -> Int;extern func __file_handle_set_nonblock(h: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__file_from_fd`.@briefBinds the low-level runtime symbol `__file_handle_set_nonblock`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- hUnderlying runtime handle.
@returnReturns the operation result as `Int`.
functionfs::__file_from_fd
Signature
extern func __file_from_fd(fd: Int, path: String, flags: Int) -> Int;extern func __file_from_fd(fd: Int, path: String, flags: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__file_ioctl`.@briefBinds the low-level runtime symbol `__file_from_fd`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- fdOperating-system file descriptor or socket descriptor.
- pathFile or directory path.
- flagsBitmask of option flags that controls how the operation is performed.
@returnReturns the operation result as `Int`.
functionfs::__file_ioctl
Signature
extern func __file_ioctl(h: Int, request: Int, data: String) -> Int;extern func __file_ioctl(h: Int, request: Int, data: String) -> Int;
/*
@brief Binds the low-level runtime symbol `__file_fsync`.@briefBinds the low-level runtime symbol `__file_ioctl`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- hUnderlying runtime handle.
- requestRequest object, request id, or encoded request payload to process.
- dataInput or output data buffer.
@returnReturns the operation result as `Int`.
functionfs::__file_fsync
Signature
extern func __file_fsync(h: Int) -> Int;extern func __file_fsync(h: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__file_handle_close`.@briefBinds the low-level runtime symbol `__file_fsync`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- hUnderlying runtime handle.
@returnReturns the operation result as `Int`.
functionfs::__file_handle_close
Signature
extern func __file_handle_close(h: Int) -> Int;extern func __file_handle_close(h: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__file_copy`.@briefBinds the low-level runtime symbol `__file_handle_close`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- hUnderlying runtime handle.
@returnReturns the operation result as `Int`.
functionfs::__file_copy
Signature
extern func __file_copy(from: String, to: String) -> Int;extern func __file_copy(from: String, to: String) -> Int;
/*
@brief Binds the low-level runtime symbol `__file_watch_once`.@briefBinds the low-level runtime symbol `__file_copy`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- fromSource endpoint, path, index, or lower boundary for the operation.
- toDestination endpoint, path, index, or upper boundary for the operation.
@returnReturns the operation result as `Int`.
functionfs::__file_watch_once
Signature
extern func __file_watch_once(path: String, timeout_ms: Int) -> Int;extern func __file_watch_once(path: String, timeout_ms: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__file_queue_len`.@briefBinds the low-level runtime symbol `__file_watch_once`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- pathFile or directory path.
- timeout_msTimeout in milliseconds; negative values usually select blocking or default timeout behavior.
@returnReturns the operation result as `Int`.
functionfs::__file_queue_len
Signature
extern func __file_queue_len() -> Int;extern func __file_queue_len() -> Int;
/*
@brief Binds the low-level runtime symbol `__file_active_count`.@briefBinds the low-level runtime symbol `__file_queue_len`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@returnReturns the operation result as `Int`.
functionfs::__file_active_count
Signature
extern func __file_active_count() -> Int;extern func __file_active_count() -> Int;
/*
@brief Binds the low-level runtime symbol `__file_max_queue`.@briefBinds the low-level runtime symbol `__file_active_count`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@returnReturns the operation result as `Int`.
functionfs::__file_max_queue
Signature
extern func __file_max_queue() -> Int;extern func __file_max_queue() -> Int;
/*
@brief Binds the low-level runtime symbol `__file_shutdown`.@briefBinds the low-level runtime symbol `__file_max_queue`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@returnReturns the operation result as `Int`.
functionfs::__file_shutdown
Signature
extern func __file_shutdown() -> Void;extern func __file_shutdown() -> Void;
/*
@brief Binds the low-level runtime symbol `__file_open_read`.@briefBinds the low-level runtime symbol `__file_shutdown`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@returnVoid
functionfs::__file_open_read
Signature
extern func __file_open_read(path: String) -> Int;extern func __file_open_read(path: String) -> Int;
/*
@brief Binds the low-level runtime symbol `__file_read_line`.@briefBinds the low-level runtime symbol `__file_open_read`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- pathFile or directory path.
@returnReturns the operation result as `Int`.
functionfs::__file_read_line
Signature
extern func __file_read_line(handle: Int) -> String;extern func __file_read_line(handle: Int) -> String;
/*
@brief Binds the low-level runtime symbol `__file_close`.@briefBinds the low-level runtime symbol `__file_read_line`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- handleUnderlying runtime handle.
@returnReturns the operation result as `String`.
functionfs::__file_close
Signature
extern func __file_close(handle: Int) -> Int;extern func __file_close(handle: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__os_mkdir`.@briefBinds the low-level runtime symbol `__file_close`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- handleUnderlying runtime handle.
@returnReturns the operation result as `Int`.
functionfs::__os_mkdir
Signature
extern func __os_mkdir(path: String) -> Int;extern func __os_mkdir(path: String) -> Int;
/*
@brief Binds the low-level runtime symbol `__os_mkdir_all`.@briefBinds the low-level runtime symbol `__os_mkdir`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- pathFile or directory path.
@returnReturns the operation result as `Int`.
functionfs::__os_mkdir_all
Signature
extern func __os_mkdir_all(path: String) -> Int;extern func __os_mkdir_all(path: String) -> Int;
/*
@brief Binds the low-level runtime symbol `__os_rename`.@briefBinds the low-level runtime symbol `__os_mkdir_all`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- pathFile or directory path.
@returnReturns the operation result as `Int`.
functionfs::__os_rename
Signature
extern func __os_rename(oldpath: String, newpath: String) -> Int;extern func __os_rename(oldpath: String, newpath: String) -> Int;
/*
@brief Binds the low-level runtime symbol `__os_getwd`.@briefBinds the low-level runtime symbol `__os_rename`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- oldpathFilesystem path or file-related value used by the operation.
- newpathFilesystem path or file-related value used by the operation.
@returnReturns the operation result as `Int`.
functionfs::__os_getwd
Signature
extern func __os_getwd() -> String;extern func __os_getwd() -> String;
/*
@brief Binds the low-level runtime symbol `__os_chdir`.@briefBinds the low-level runtime symbol `__os_getwd`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@returnReturns the operation result as `String`.
functionfs::__os_chdir
Signature
extern func __os_chdir(path: String) -> Int;extern func __os_chdir(path: String) -> Int;
/*
@brief Binds the low-level runtime symbol `__os_temp_dir`.@briefBinds the low-level runtime symbol `__os_chdir`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- pathFile or directory path.
@returnReturns the operation result as `Int`.
functionfs::__os_temp_dir
Signature
extern func __os_temp_dir() -> String;extern func __os_temp_dir() -> String;
/*
@brief Binds the low-level runtime symbol `__os_stat_size`.@briefBinds the low-level runtime symbol `__os_temp_dir`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@returnReturns the operation result as `String`.
functionfs::__os_stat_size
Signature
extern func __os_stat_size(path: String) -> Int;extern func __os_stat_size(path: String) -> Int;
/*
@brief Binds the low-level runtime symbol `__os_stat_is_dir`.@briefBinds the low-level runtime symbol `__os_stat_size`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- pathFile or directory path.
@returnReturns the operation result as `Int`.
functionfs::__os_stat_is_dir
Signature
extern func __os_stat_is_dir(path: String) -> Int;extern func __os_stat_is_dir(path: String) -> Int;
/*@briefBinds the low-level runtime symbol `__os_stat_is_dir`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- pathFile or directory path.
@returnReturns the operation result as `Int`.
functionfs::file_exists
Signature
func file_exists(path: String) -> Boolfunc file_exists(path: String) -> Bool {
return __file_exists(path) == 1;
}@briefProvides the system library operation `file_exists`.
@detailsExecutes the `file_exists` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- pathFile or directory path.
@returnReturns a boolean result; true means the condition holds or the operation succeeded.
functionfs::file_remove
Signature
func file_remove(path: String) -> Boolfunc file_remove(path: String) -> Bool {
return __file_remove(path) == 1;
}@briefProvides the system library operation `file_remove`.
@detailsExecutes the `file_remove` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- pathFile or directory path.
@returnReturns a boolean result; true means the condition holds or the operation succeeded.
functionfs::file_write_text
Signature
func file_write_text(path: String, data: String) -> Boolfunc file_write_text(path: String, data: String) -> Bool {
return __file_write_text(path, data) == 1;
}@briefProvides the system library operation `file_write_text`.
@detailsExecutes the `file_write_text` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- pathFile or directory path.
- dataInput or output data buffer.
@returnReturns a boolean result; true means the condition holds or the operation succeeded.
functionfs::file_read_text
Signature
func file_read_text(path: String) -> Stringfunc file_read_text(path: String) -> String {
return __file_read_text(path);
}@briefProvides the system library operation `file_read_text`.
@detailsExecutes the `file_read_text` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- pathFile or directory path.
@returnReturns the operation result as `String`.
functionfs::file_open_read
Signature
func file_open_read(path: String) -> Intfunc file_open_read(path: String) -> Int {
return __file_open_read(path);
}@briefProvides the system library operation `file_open_read`.
@detailsExecutes the `file_open_read` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- pathFile or directory path.
@returnReturns the operation result as `Int`.
functionfs::file_read_line
Signature
func file_read_line(handle: Int) -> Stringfunc file_read_line(handle: Int) -> String {
return __file_read_line(handle);
}@briefProvides the system library operation `file_read_line`.
@detailsExecutes the `file_read_line` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- handleUnderlying runtime handle.
@returnReturns the operation result as `String`.
functionfs::flag_read
Signature
func flag_read() -> Intfunc flag_read() -> Int {
return 1;
}@briefProvides the system library operation `flag_read`.
@detailsExecutes the `flag_read` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@returnReturns the operation result as `Int`.
functionfs::flag_write
Signature
func flag_write() -> Intfunc flag_write() -> Int {
return 2;
}@briefProvides the system library operation `flag_write`.
@detailsExecutes the `flag_write` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@returnReturns the operation result as `Int`.
functionfs::flag_create
Signature
func flag_create() -> Intfunc flag_create() -> Int {
return 4;
}@briefProvides the system library operation `flag_create`.
@detailsExecutes the `flag_create` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@returnReturns the operation result as `Int`.
functionfs::flag_trunc
Signature
func flag_trunc() -> Intfunc flag_trunc() -> Int {
return 8;
}@briefProvides the system library operation `flag_trunc`.
@detailsExecutes the `flag_trunc` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@returnReturns the operation result as `Int`.
functionfs::flag_append
Signature
func flag_append() -> Intfunc flag_append() -> Int {
return 16;
}@briefProvides the system library operation `flag_append`.
@detailsExecutes the `flag_append` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@returnReturns the operation result as `Int`.
functionfs::FileInfo.init
Signature
func init(self: fs.FileInfo) -> Void func init(self: fs.FileInfo) -> Void {
self.name = "";
self.size = 0;@briefInitializes a `FileInfo` instance.
@detailsEstablishes the initial field state for `FileInfo` so other methods can be called safely. Constructor logic should keep fields consistent and avoid leaking partially initialized resources.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionfs::FileInfo.deinit
Signature
func deinit(self: fs.FileInfo) -> Void func deinit(self: fs.FileInfo) -> Void {
}
}@briefReleases fallback resources at the end of the `FileInfo` lifetime.
@detailsThis destructor hook is called by object lifetime management to clean up underlying resources that were not released explicitly. Normal application code should prefer `dispose`, `close`, or the module-specific close function to release resources at a deterministic time.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionfs::File.init
Signature
func init(self: File, path: String = "", h: Int = 0, owns_handle: Bool = false) -> Void func init(self: File, path: String = "", h: Int = 0, owns_handle: Bool = false) -> Void {
self.path = path;
self.h = h;@briefInitializes a `File` instance.
@detailsEstablishes the initial field state for `File` so other methods can be called safely. Constructor logic should keep fields consistent and avoid leaking partially initialized resources.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- pathFile or directory path.
- hUnderlying runtime handle.
- owns_handleWhether the object owns the native handle and must release it during cleanup.
@returnVoid
functionfs::File.deinit
Signature
func deinit(self: File) -> Void func deinit(self: File) -> Void {
if self.owns_handle && !self.closed && self.h != 0 {
_ = fs.close(self.h);@briefReleases fallback resources at the end of the `File` lifetime.
@detailsThis destructor hook is called by object lifetime management to clean up underlying resources that were not released explicitly. Normal application code should prefer `dispose`, `close`, or the module-specific close function to release resources at a deterministic time.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionfs::File.read
Signature
func read(self: File, max_bytes: Int) -> bytes.Bytes, ErrCode func read(self: File, max_bytes: Int) -> bytes.Bytes, ErrCode {
if self.closed {
return "", std.ERR_INVALID;@briefReads data with `File.read`.
@detailsExecutes the `read` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- max_bytesMaximum number of bytes to read or process in this operation.
@returnReturns `bytes.Bytes, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::File.read_all
Signature
func read_all(self: File) -> bytes.Bytes, ErrCode func read_all(self: File) -> bytes.Bytes, ErrCode {
if self.closed {
return "", std.ERR_INVALID;@briefReads all available data with `File.read_all`.
@detailsExecutes the `read_all` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnReturns `bytes.Bytes, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::File.write
Signature
func write(self: File, data: bytes.Bytes) -> Int, ErrCode func write(self: File, data: bytes.Bytes) -> Int, ErrCode {
if self.closed {
return 0, std.ERR_INVALID;@briefWrites data with `File.write`.
@detailsExecutes the `write` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- dataInput or output data buffer.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::File.close
Signature
func close(self: File) -> ErrCode func close(self: File) -> ErrCode {
if self.closed {
return std.OK;@briefCloses resources and makes later operations unavailable with `File.close`.
@detailsExecutes the `close` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::File.dispose
Signature
func dispose(self: File) -> Void func dispose(self: File) -> Void {
_ = self.close();
}@briefExplicitly releases resources owned by `File`.
@detailsThis method deterministically cleans up file descriptors, network connections, native handles, buffers, or other external resources. Implementations should be idempotent where possible, and repeated calls must not corrupt object state.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionfs::Stream.init
Signature
func init(self: fs.Stream) -> Void func init(self: fs.Stream) -> Void {
self.h = 0;
self.offset = 0;@briefInitializes a `Stream` instance.
@detailsEstablishes the initial field state for `Stream` so other methods can be called safely. Constructor logic should keep fields consistent and avoid leaking partially initialized resources.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionfs::Stream.deinit
Signature
func deinit(self: fs.Stream) -> Void func deinit(self: fs.Stream) -> Void {
if self.owns_handle && !self.closed && self.h != 0 {
_ = fs.stream_close(self);@briefReleases fallback resources at the end of the `Stream` lifetime.
@detailsThis destructor hook is called by object lifetime management to clean up underlying resources that were not released explicitly. Normal application code should prefer `dispose`, `close`, or the module-specific close function to release resources at a deterministic time.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionfs::Stream.dispose
Signature
func dispose(self: fs.Stream) -> Void func dispose(self: fs.Stream) -> Void {
_ = fs.stream_close(self);
}@briefExplicitly releases resources owned by `Stream`.
@detailsThis method deterministically cleans up file descriptors, network connections, native handles, buffers, or other external resources. Implementations should be idempotent where possible, and repeated calls must not corrupt object state.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionfs::open
Signature
func open(path: String, flags: Int = 1, mode: Int = 420) -> Int, ErrCodefunc open(path: String, flags: Int = 1, mode: Int = 420) -> Int, ErrCode {
let h: Int = __file_open(path, flags, mode);
if h != 0 {@briefProvides the system library operation `open`.
@detailsExecutes the `open` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- pathFile or directory path.
- flagsBitmask of option flags that controls how the operation is performed.
- modeMode value that selects permissions, behavior, or formatting rules for the operation.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::open_file
Signature
func open_file(path: String, flags: Int = 1, mode: Int = 420) -> fs.File, ErrCodefunc open_file(path: String, flags: Int = 1, mode: Int = 420) -> fs.File, ErrCode {
let h: Int = open(path, flags, mode)?;
return new File(path, h, true), std.OK;@briefOpens a resource with `open_file`.
@detailsExecutes the `open_file` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- pathFile or directory path.
- flagsBitmask of option flags that controls how the operation is performed.
- modeMode value that selects permissions, behavior, or formatting rules for the operation.
@returnReturns `fs.File, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::create
Signature
func create(path: String) -> File, ErrCodefunc create(path: String) -> File, ErrCode {
return open_file(path, 1 + 2 + 4 + 8, 420);
}@briefProvides the system library operation `create`.
@detailsExecutes the `create` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- pathFile or directory path.
@returnReturns `File, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::read_text
Signature
func read_text(path: String) -> String, ErrCodefunc read_text(path: String) -> String, ErrCode {
if __file_exists(path) != 1 {
return "", std.ERR_NOT_FOUND;@briefReads data with `read_text`.
@detailsExecutes the `read_text` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- pathFile or directory path.
@returnReturns `String, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::read_bytes
Signature
func read_bytes(path: String, max_bytes: Int) -> bytes.Bytes, ErrCodefunc read_bytes(path: String, max_bytes: Int) -> bytes.Bytes, ErrCode {
if __file_exists(path) != 1 {
return "", std.ERR_NOT_FOUND;@briefReads data with `read_bytes`.
@detailsExecutes the `read_bytes` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- pathFile or directory path.
- max_bytesMaximum number of bytes to read or process in this operation.
@returnReturns `bytes.Bytes, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::write_text
Signature
func write_text(path: String, data: String) -> Int, ErrCodefunc write_text(path: String, data: String) -> Int, ErrCode {
if __file_write_text(path, data) == 1 {
return std.len(data), std.OK;@briefWrites data with `write_text`.
@detailsExecutes the `write_text` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- pathFile or directory path.
- dataInput or output data buffer.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::write_bytes
Signature
func write_bytes(path: String, data: bytes.Bytes) -> Int, ErrCodefunc write_bytes(path: String, data: bytes.Bytes) -> Int, ErrCode {
if __file_write_bytes(path, data) == 1 {
return bytes.len(data), std.OK;@briefWrites data with `write_bytes`.
@detailsExecutes the `write_bytes` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- pathFile or directory path.
- dataInput or output data buffer.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::read_path_at
Signature
func read_path_at(path: String, offset: Int, max_bytes: Int) -> bytes.Bytes, ErrCodefunc read_path_at(path: String, offset: Int, max_bytes: Int) -> bytes.Bytes, ErrCode {
if offset < 0 {
return "", std.ERR_INVALID;@briefReads data with `read_path_at`.
@detailsExecutes the `read_path_at` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- pathFile or directory path.
- offsetByte offset measured from the start position.
- max_bytesMaximum number of bytes to read or process in this operation.
@returnReturns `bytes.Bytes, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::write_path_at
Signature
func write_path_at(path: String, offset: Int, data: bytes.Bytes) -> Int, ErrCodefunc write_path_at(path: String, offset: Int, data: bytes.Bytes) -> Int, ErrCode {
if offset < 0 {
return 0, std.ERR_INVALID;@briefWrites data with `write_path_at`.
@detailsExecutes the `write_path_at` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- pathFile or directory path.
- offsetByte offset measured from the start position.
- dataInput or output data buffer.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::read_at
Signature
func read_at(h: Int, offset: Int, max_bytes: Int) -> bytes.Bytes, ErrCodefunc read_at(h: Int, offset: Int, max_bytes: Int) -> bytes.Bytes, ErrCode {
if h == 0 || offset < 0 {
return "", std.ERR_INVALID;@briefReads data with `read_at`.
@detailsExecutes the `read_at` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- hUnderlying runtime handle.
- offsetByte offset measured from the start position.
- max_bytesMaximum number of bytes to read or process in this operation.
@returnReturns `bytes.Bytes, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::write_at
Signature
func write_at(h: Int, offset: Int, data: bytes.Bytes) -> Int, ErrCodefunc write_at(h: Int, offset: Int, data: bytes.Bytes) -> Int, ErrCode {
if h == 0 || offset < 0 {
return 0, std.ERR_INVALID;@briefWrites data with `write_at`.
@detailsExecutes the `write_at` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- hUnderlying runtime handle.
- offsetByte offset measured from the start position.
- dataInput or output data buffer.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::read_raw
Signature
func read_raw(h: Int, max_bytes: Int) -> bytes.Bytes, ErrCodefunc read_raw(h: Int, max_bytes: Int) -> bytes.Bytes, ErrCode {
if h == 0 {
return "", std.ERR_INVALID;@briefReads data with `read_raw`.
@detailsExecutes the `read_raw` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- hUnderlying runtime handle.
- max_bytesMaximum number of bytes to read or process in this operation.
@returnReturns `bytes.Bytes, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::write_raw
Signature
func write_raw(h: Int, data: bytes.Bytes) -> Int, ErrCodefunc write_raw(h: Int, data: bytes.Bytes) -> Int, ErrCode {
if h == 0 {
return 0, std.ERR_INVALID;@briefWrites data with `write_raw`.
@detailsExecutes the `write_raw` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- hUnderlying runtime handle.
- dataInput or output data buffer.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::set_nonblock
Signature
func set_nonblock(h: Int) -> ErrCodefunc set_nonblock(h: Int) -> ErrCode {
if h == 0 {
return std.ERR_INVALID;@briefSets state or configuration with `set_nonblock`.
@detailsExecutes the `set_nonblock` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- hUnderlying runtime handle.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::file_from_fd
Signature
func file_from_fd(fd: Int, path: String = "", flags: Int = 3) -> fs.File, ErrCodefunc file_from_fd(fd: Int, path: String = "", flags: Int = 3) -> fs.File, ErrCode {
if fd < 0 {
return new fs.File(), std.ERR_INVALID;@briefProvides the system library operation `file_from_fd`.
@detailsExecutes the `file_from_fd` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- fdOperating-system file descriptor or socket descriptor.
- pathFile or directory path.
- flagsBitmask of option flags that controls how the operation is performed.
@returnReturns `fs.File, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::ioctl
Signature
func ioctl(h: Int, request: Int, data: bytes.Bytes = "") -> Int, ErrCodefunc ioctl(h: Int, request: Int, data: bytes.Bytes = "") -> Int, ErrCode {
if h == 0 || request < 0 {
return 0, std.ERR_INVALID;@briefProvides the system library operation `ioctl`.
@detailsExecutes the `ioctl` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- hUnderlying runtime handle.
- requestRequest object, request id, or encoded request payload to process.
- dataInput or output data buffer.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::fsync
Signature
func fsync(h: Int) -> Int, ErrCodefunc fsync(h: Int) -> Int, ErrCode {
if h == 0 {
return 0, std.ERR_INVALID;@briefProvides the system library operation `fsync`.
@detailsExecutes the `fsync` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- hUnderlying runtime handle.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::close
Signature
func close(h: Int) -> Voidfunc close(h: Int) -> Void {
if __file_handle_close(h) != 1 {
_ = __file_close(h);@briefCloses resources and makes later operations unavailable with `close`.
@detailsExecutes the `close` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- hUnderlying runtime handle.
@returnVoid
functionfs::file_from_handle
Signature
func file_from_handle(h: Int) -> fs.Filefunc file_from_handle(h: Int) -> fs.File {
return new fs.File("", h, false);
}@briefProvides the system library operation `file_from_handle`.
@detailsExecutes the `file_from_handle` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- hUnderlying runtime handle.
@returnReturns the operation result as `fs.File`.
functionfs::file_read
Signature
func file_read(f: fs.File, max_bytes: Int) -> bytes.Bytes, ErrCodefunc file_read(f: fs.File, max_bytes: Int) -> bytes.Bytes, ErrCode {
return f.read(max_bytes);
}@briefProvides the system library operation `file_read`.
@detailsExecutes the `file_read` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- fFuture, callback, file handle, or function object that the operation observes or invokes.
- max_bytesMaximum number of bytes to read or process in this operation.
@returnReturns `bytes.Bytes, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::file_write
Signature
func file_write(f: fs.File, data: bytes.Bytes) -> Int, ErrCodefunc file_write(f: fs.File, data: bytes.Bytes) -> Int, ErrCode {
return f.write(data);
}@briefProvides the system library operation `file_write`.
@detailsExecutes the `file_write` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- fFuture, callback, file handle, or function object that the operation observes or invokes.
- dataInput or output data buffer.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::file_close
Signature
func file_close(f: fs.File) -> ErrCodefunc file_close(f: fs.File) -> ErrCode {
return f.close();
}@briefProvides the system library operation `file_close`.
@detailsExecutes the `file_close` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- fFuture, callback, file handle, or function object that the operation observes or invokes.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::stream_from_handle
Signature
func stream_from_handle(h: Int, chunk_size: Int, owns_handle: Bool = false) -> fs.Streamfunc stream_from_handle(h: Int, chunk_size: Int, owns_handle: Bool = false) -> fs.Stream {
let s = new fs.Stream();
s.h = h;@briefProvides the system library operation `stream_from_handle`.
@detailsExecutes the `stream_from_handle` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- hUnderlying runtime handle.
- chunk_sizeSize or length value that limits how much data the operation processes.
- owns_handleWhether the object owns the native handle and must release it during cleanup.
@returnReturns the operation result as `fs.Stream`.
functionfs::stream_read
Signature
func stream_read(s: fs.Stream) -> bytes.Bytes, ErrCodefunc stream_read(s: fs.Stream) -> bytes.Bytes, ErrCode {
if s.closed {
return "", std.ERR_INVALID;@briefProvides the system library operation `stream_read`.
@detailsExecutes the `stream_read` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
@returnReturns `bytes.Bytes, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::stream_write
Signature
func stream_write(s: fs.Stream, data: bytes.Bytes) -> Int, ErrCodefunc stream_write(s: fs.Stream, data: bytes.Bytes) -> Int, ErrCode {
if s.closed {
return 0, std.ERR_INVALID;@briefProvides the system library operation `stream_write`.
@detailsExecutes the `stream_write` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
- dataInput or output data buffer.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::stream_close
Signature
func stream_close(s: fs.Stream) -> Voidfunc stream_close(s: fs.Stream) -> Void {
if !s.closed && s.h != 0 && s.owns_handle {
_ = fs.close(s.h);@briefProvides the system library operation `stream_close`.
@detailsExecutes the `stream_close` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- sInput string.
@returnVoid
functionfs::remove
Signature
func remove(path: String) -> Int, ErrCodefunc remove(path: String) -> Int, ErrCode {
if __file_exists(path) != 1 {
return 0, std.ERR_NOT_FOUND;@briefRemoves an element or resource with `remove`.
@detailsExecutes the `remove` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- pathFile or directory path.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::exists
Signature
func exists(path: String) -> Bool, ErrCodefunc exists(path: String) -> Bool, ErrCode {
return __file_exists(path) == 1, std.OK;
}@briefProvides the system library operation `exists`.
@detailsExecutes the `exists` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- pathFile or directory path.
@returnReturns `Bool, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::mkdir
Signature
func mkdir(path: String) -> Int, ErrCodefunc mkdir(path: String) -> Int, ErrCode {
if __os_mkdir(path) == 1 {
return 0, std.OK;@briefProvides the system library operation `mkdir`.
@detailsExecutes the `mkdir` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- pathFile or directory path.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::mkdir_all
Signature
func mkdir_all(path: String) -> Int, ErrCodefunc mkdir_all(path: String) -> Int, ErrCode {
if __os_mkdir_all(path) == 1 {
return 0, std.OK;@briefProvides the system library operation `mkdir_all`.
@detailsExecutes the `mkdir_all` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- pathFile or directory path.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::rename
Signature
func rename(oldpath: String, newpath: String) -> Int, ErrCodefunc rename(oldpath: String, newpath: String) -> Int, ErrCode {
if __os_rename(oldpath, newpath) == 1 {
return 0, std.OK;@briefProvides the system library operation `rename`.
@detailsExecutes the `rename` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- oldpathFilesystem path or file-related value used by the operation.
- newpathFilesystem path or file-related value used by the operation.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::copy
Signature
func copy(from: String, to: String) -> Int, ErrCodefunc copy(from: String, to: String) -> Int, ErrCode {
let n: Int = __file_copy(from, to);
if n < 0 {@briefProvides the system library operation `copy`.
@detailsExecutes the `copy` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- fromSource endpoint, path, index, or lower boundary for the operation.
- toDestination endpoint, path, index, or upper boundary for the operation.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::getwd
Signature
func getwd() -> String, ErrCodefunc getwd() -> String, ErrCode {
let wd: String = __os_getwd();
if std.len(wd) == 0 {@briefProvides the system library operation `getwd`.
@detailsExecutes the `getwd` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@returnReturns `String, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::chdir
Signature
func chdir(path: String) -> Int, ErrCodefunc chdir(path: String) -> Int, ErrCode {
if __os_chdir(path) == 1 {
return 0, std.OK;@briefProvides the system library operation `chdir`.
@detailsExecutes the `chdir` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- pathFile or directory path.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::temp_dir
Signature
func temp_dir() -> String, ErrCodefunc temp_dir() -> String, ErrCode {
let d: String = __os_temp_dir();
if std.len(d) == 0 {@briefProvides the system library operation `temp_dir`.
@detailsExecutes the `temp_dir` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@returnReturns `String, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::stat_size
Signature
func stat_size(path: String) -> Int, ErrCodefunc stat_size(path: String) -> Int, ErrCode {
let n: Int = __os_stat_size(path);
if n < 0 {@briefProvides the system library operation `stat_size`.
@detailsExecutes the `stat_size` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- pathFile or directory path.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::stat_is_dir
Signature
func stat_is_dir(path: String) -> Bool, ErrCodefunc stat_is_dir(path: String) -> Bool, ErrCode {
let n: Int = __os_stat_is_dir(path);
if n < 0 {@briefProvides the system library operation `stat_is_dir`.
@detailsExecutes the `stat_is_dir` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- pathFile or directory path.
@returnReturns `Bool, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::watch_once
Signature
func watch_once(path: String, timeout_ms: Int) -> Int, ErrCodefunc watch_once(path: String, timeout_ms: Int) -> Int, ErrCode {
if __file_watch_once(path, timeout_ms) == 1 {
return 1, std.OK;@briefProvides the system library operation `watch_once`.
@detailsExecutes the `watch_once` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- pathFile or directory path.
- timeout_msTimeout in milliseconds; negative values usually select blocking or default timeout behavior.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionfs::cancel_all
Signature
func cancel_all() -> Intfunc cancel_all() -> Int {
return 0;
}@briefProvides the system library operation `cancel_all`.
@detailsExecutes the `cancel_all` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@returnReturns the operation result as `Int`.
functionfs::cancel_handle
Signature
func cancel_handle(h: Int) -> Intfunc cancel_handle(h: Int) -> Int {
return 0;
}@briefProvides the system library operation `cancel_handle`.
@detailsExecutes the `cancel_handle` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- hUnderlying runtime handle.
@returnReturns the operation result as `Int`.
functionfs::cancel_future_int
Signature
func cancel_future_int(f: Int) -> Intfunc cancel_future_int(f: Int) -> Int {
return 0;
}@briefProvides the system library operation `cancel_future_int`.
@detailsExecutes the `cancel_future_int` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- fFuture, callback, file handle, or function object that the operation observes or invokes.
@returnReturns the operation result as `Int`.
functionfs::cancel_future_string
Signature
func cancel_future_string(f: Int) -> Intfunc cancel_future_string(f: Int) -> Int {
return 0;
}@briefProvides the system library operation `cancel_future_string`.
@detailsExecutes the `cancel_future_string` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- fFuture, callback, file handle, or function object that the operation observes or invokes.
@returnReturns the operation result as `Int`.
functionfs::cancel_future_bytes
Signature
func cancel_future_bytes(f: Int) -> Intfunc cancel_future_bytes(f: Int) -> Int {
return 0;
}@briefProvides the system library operation `cancel_future_bytes`.
@detailsExecutes the `cancel_future_bytes` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- fFuture, callback, file handle, or function object that the operation observes or invokes.
@returnReturns the operation result as `Int`.
functionfs::queue_len
Signature
func queue_len() -> Intfunc queue_len() -> Int {
return __file_queue_len();
}@briefProvides the system library operation `queue_len`.
@detailsExecutes the `queue_len` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@returnReturns the operation result as `Int`.
functionfs::active_count
Signature
func active_count() -> Intfunc active_count() -> Int {
return __file_active_count();
}@briefProvides the system library operation `active_count`.
@detailsExecutes the `active_count` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@returnReturns the operation result as `Int`.
functionfs::max_queue
Signature
func max_queue() -> Intfunc max_queue() -> Int {
return __file_max_queue();
}@briefProvides the system library operation `max_queue`.
@detailsExecutes the `max_queue` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@returnReturns the operation result as `Int`.
functionfs::shutdown
Signature
func shutdown() -> Voidfunc shutdown() -> Void {
_ = __file_shutdown();
}@briefProvides the system library operation `shutdown`.
@detailsExecutes the `shutdown` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@returnVoid
functionfs::stat
Signature
func stat(path: String) -> fs.FileInfo, ErrCodefunc stat(path: String) -> fs.FileInfo, ErrCode {
let out: fs.FileInfo = new fs.FileInfo();
out.name = file_info_name(path);@briefProvides the system library operation `stat`.
@detailsExecutes the `stat` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- pathFile or directory path.
@returnReturns `fs.FileInfo, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
Variables
Class fields (var).
varfs::FileInfo.name
Type
String@brief`name` field.
@detailsHolds the `name` value for each `FileInfo` instance. The field type is `String`, and constructors and methods keep it synchronized with the object's runtime state.
var name: String;
/*
@brief `size` field.varfs::FileInfo.size
Type
Int@brief`size` field.
@detailsStores a size or capacity value. The field type is `Int`, and it is maintained by the constructors and methods of `FileInfo`.
var size: Int;
/*
@brief `is_dir` field.varfs::FileInfo.is_dir
Type
Bool@brief`is_dir` field.
@detailsHolds the `is_dir` value for each `FileInfo` instance. The field type is `Bool`, and constructors and methods keep it synchronized with the object's runtime state.
var is_dir: Bool;
/*
@brief `ok` field.varfs::FileInfo.ok
Type
Bool@brief`ok` field.
@detailsIndicates whether the operation or state is valid. The field type is `Bool`, and it is maintained by the constructors and methods of `FileInfo`.
var ok: Bool;
/*varfs::File.path
Type
String@brief`path` field.
@detailsStores the associated filesystem path. The field type is `String`, and it is maintained by the constructors and methods of `File`.
var path: String;
/*
@brief `h` field.varfs::File.h
Type
Int@brief`h` field.
@detailsStores the underlying runtime handle. The field type is `Int`, and it is maintained by the constructors and methods of `File`.
var h: Int;
/*
@brief `offset` field.varfs::File.offset
Type
Int@brief`offset` field.
@detailsStores the current read/write offset. The field type is `Int`, and it is maintained by the constructors and methods of `File`.
var offset: Int;
/*
@brief `closed` field.varfs::File.closed
Type
Bool@brief`closed` field.
@detailsIndicates whether the resource has already been closed. The field type is `Bool`, and it is maintained by the constructors and methods of `File`.
var closed: Bool;
/*
@brief `owns_handle` field.varfs::File.owns_handle
Type
Bool@brief`owns_handle` field.
@detailsIndicates whether the object owns and must release the underlying handle. The field type is `Bool`, and it is maintained by the constructors and methods of `File`.
var owns_handle: Bool;
/*varfs::Stream.h
Type
Int@brief`h` field.
@detailsStores the underlying runtime handle. The field type is `Int`, and it is maintained by the constructors and methods of `Stream`.
var h: Int;
/*
@brief `offset` field.varfs::Stream.offset
Type
Int@brief`offset` field.
@detailsStores the current read/write offset. The field type is `Int`, and it is maintained by the constructors and methods of `Stream`.
var offset: Int;
/*
@brief `closed` field.varfs::Stream.chunk_size
Type
Int@brief`chunk_size` field.
@detailsHolds the `chunk_size` value for each `Stream` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var chunk_size: Int;
/*
@brief `closed` field.varfs::Stream.closed
Type
Bool@brief`closed` field.
@detailsIndicates whether the resource has already been closed. The field type is `Bool`, and it is maintained by the constructors and methods of `Stream`.
var closed: Bool;
/*
@brief `owns_handle` field.varfs::Stream.owns_handle
Type
Bool@brief`owns_handle` field.
@detailsIndicates whether the object owns and must release the underlying handle. The field type is `Bool`, and it is maintained by the constructors and methods of `Stream`.
var owns_handle: Bool;
/*