fs
Generated by tinox doc
tinox.core.fs, bundled with the compiler and also available as a standalone tinox-central package.
Read write file
import tinox.core.fs
class Main
{
fnc main() -> Int32
{
Fs::writeFile("/tmp/greeting.txt", "hello from tinox\n")
Fs::appendFile("/tmp/greeting.txt", "second line\n")
const content: String = Fs::readFile("/tmp/greeting.txt")
println(content)
Fs::copyFile("/tmp/greeting.txt", "/tmp/greeting-copy.txt")
const files: List<String> = Fs::listDirectory("/tmp")
println("entries: " + files.len().toString())
Fs::deleteFile("/tmp/greeting-copy.txt")
return 0
}
}
class FileInfo
Owned metadata snapshot. Permissions are POSIX mode bits (07777). * modifiedNanoseconds is signed Unix time; unrepresentable times throw. * name is the supplied path for stat, or the basename for listEntries.
Fields
name | String | |
kind | String | |
size | Int64 | |
modifiedNanoseconds | Int64 | |
permissions | Int64 |
fn fsMetadataChecked(path: String, listing: Int64) → List<String>
fn fsRenameChecked(from: String, to: String) → String
fn fsRemoveDirectoryChecked(path: String, recursive: Int64) → String
fn fsRealPathChecked(path: String) → List<String>
fn fsHomeDirectoryChecked() → List<String>
fn fsReadTextOutcome(path: String) → List<String>
fn fsWriteTextOutcome(path: String, text: String, append: Int64) → List<String>
fn fsCopyOutcome(from: String, to: String) → List<String>
fn fsMutateOutcome(from: String, to: String, move: Int64) → List<String>
class Fs
Methods
@Errorclass IoError
* A file-system operation failed; `message` carries the operating system's reason.
Fields
message | String |
class IoFailure
Fields
code | Int64 | |
operation | String | |
target | String | |
cause | String |
Methods
class IoResult<T>
Fields
values | List<T> | |
failures | List<IoFailure> |
Methods
class WatchEvent
* One file-system change reported by a Watcher. * * kind is one of "created", "modified", "deleted", "moved" or "overflow". * An "overflow" event (empty path) means the kernel dropped events: treat * every watched tree as changed and rescan it. For "moved", path is the * new location and oldPath the previous one; a path moved into or out of * the watched tree is reported as "created" or "deleted" instead.
Fields
kind | String | |
path | String | |
oldPath | String | |
isDirectory | Bool |
fn watchCreate() → Int64
fn watchLastError() → String
fn watchAdd(handle: Int64, path: String, recursive: Bool) → String
fn watchRemove(handle: Int64, path: String) → Nothing
fn watchPoll(handle: Int64, timeoutMs: Int64, debounceMs: Int64) → List<String>
fn watchClose(handle: Int64) → Nothing
class Watcher
* Watches files and directories for changes (Linux inotify). Typical * use is one task looping on poll(): * * const w = Watcher::create(50) * Watcher::watch(w, "/path/to/project", true) * while (running) { * for (e in Watcher::poll(w, 1000)) { ... } * } * Watcher::close(w) * * Recursive watches follow directories created later. Operations on one * Watcher are serialised; poll() blocks only its own caller. Watches * count against the kernel's fs.inotify.max_user_watches; hitting that * limit is reported as an error from watch(), never silently ignored.
Fields
handle | Int64 | |
debounceMs | Int64 |