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 Fs
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 |