All the functions in the system library are usable in all agi runtime and do not need to include using requirelib
function.
BUILD_VERSION
INTERNVAL_VERSION
LOADED_MODULES
LOADED_STORAGES
HTTP_RESP
HTTP_HEADER (Default: "text/plain")
You can set HTTP_RESP with HTTP_HEADER to create custom response headers. For example, you can serve an HTML file using agi gateway
HTTP_RESP = "<html><body>Hello World</body></html>";
HTTP_HEADER = "text/html";
sendResp("Any string");
sendJSONResp(JSON.stringify({text: "Hello World")); //ArozOS v1 / v2
sendJSONResp({foo: 'bar'}); //ArozOS v2 only
newDBTableIfNotExists("tablename");
DBTableExists("tablename"); //Return true/false
dropDBTable("tablename");
writeDBItem("tablename", "key", "value");
readDBItem("tablename", "key"); //Return false if read failed
listDBTable("tablename"); //Return key value array
deleteDBItem("tablename", "key");
registerModule(JSON.stringify(moduleLaunchInfo)); //See start script sections for examples
You can also include another js / agi file to load shared code between scripts
includes("hello world.js"); //Include another js / agi file within the current running one, return false if failed
To print something for debug, you can print text directly to ArOZ Online Core terminal using
console.log("text");
Synchronized delay (or blocking delay) can be used with the delay function (ms)
delay(5000);
For async delayed / timer ticking operations like setTimeout or setInterval is currently not supported.
Instantly terminate and exit the runtime
exit();
Deprecated since v2.018: ffmpeg exec was replaced by work in progress ffmpeg library in agi core.
requirepkg("ffmpeg");
execpkg("ffmpeg",'-i "files/users/TC/Desktop/įž¤é.mp3" "files/users/TC/Desktop/įž¤é.flac'); //ffmpeg must be required() before use