The Barrier — Files/Database
File I/O, directory operations
Read entire file contents as string.
ayanmo content = Odi.read("data.txt");
Irosu.fo(content);
Write string to file (overwrites).
Odi.write("output.txt", "Hello, World!");
Odi.k?("data.json", "{\"name\": \"Ifá\"}");
Append string to file.
Odi.append("log.txt", "New entry\n");
Check if file or directory exists.
ti (Odi.exists("config.json")) {
ayanmo config = Odi.read("config.json");
}
Delete a file.
Odi.delete("temp.txt");
Odi.pa("old_data.json");
List directory contents.
ayanmo files = Odi.list("./src");
fun file ninu files {
Irosu.fo(file);
}
Create directory (and parents).
Odi.mkdir("data/backups/2024");
// Read or create config
ayanmo config_path = "settings.json";
ti (Odi.exists(config_path)) {
ayanmo config = Odi.read(config_path);
Irosu.fo("Config loaded");
} bib?k? {
ayanmo default_config = "{\"theme\": \"dark\"}";
Odi.write(config_path, default_config);
Irosu.fo("Default config created");
}