gizlang/kept
the machine's derived data, each kept by the hash of what it is made of, so a program's next start reads it back instead of making it again (a game's textures in their blocks, a rig's centers of rotation). An entry is bytes; its maker encodes it. A host with no file system (a page) keeps nothing and makes each every time.
import * as Kept from "gizlang/kept";Functions
folder
function folder(kind: string): stringThe folder of KIND's entries in the machine's cache, "" when there is none.
Effects: fail, io, alloc.
keyOf
function keyOf(source: bytes, version: string, options: string = ""): stringThe key of an entry made of SOURCE by the maker's VERSION and its OPTIONS: a new version makes every entry again.
Effects: fail, alloc.
read
function read(folder: string, key: string): bytes | undefinedThe entry KEY in FOLDER, or none.
Effects: fail, io, alloc.
write
function write(folder: string, key: string, data: bytes): voidKeeps DATA as entry KEY in FOLDER, replacing the file there in one step. It is not synced: a crash that cuts the file short leaves a corrupt entry, which its reader refuses and makes again. A write that fails keeps no entry.
Effects: fail, read, write, console, io, alloc.