Tycho IO — backend-neutral file, asset and clock access shared by the desktop, mobile and browser targets
Part of the Tycho graphics stack — mounted there as the io/ submodule.
| Target | Implementation | Behaviour |
|---|---|---|
| native | impl_native.mbt + io_stub.c | Real file system. A relative path is tried as given, then through a walk-up from the executable directory (up to 12 levels), because examples run from _build/.... |
| js | impl_js.mbt | In-page virtual file system on globalThis.__tycho_io.files. A write_file is visible to a later read_file within one page; nothing persists across page loads, so real URLs must be preloaded into the map. |
let bytes = @io.read_file("assets/scene.json")
if @io.asset_exists("assets/scene.json") {
@io.write_file("out/copy.json", bytes)
}
let t0 = @io.now_ms()moon run smoke --target native # round trip through the real file system
moon run smoke_js --target js # same contract against the in-page mapfn now_ms() -> UInt64fn read_file(path : String) -> Bytesfn write_file(path : String, data : Bytes) -> BoolInstall
Download zipTycho IO — backend-neutral file, asset and clock access shared by the desktop, mobile and browser targets