This demo demonstrate how to load binary data assets with Shaku.
Dynamically loading binary files can be used for anything that's not JSON or the built-in supported types (texture / audio).
The following content was loaded from a static binary file (its actually a JSON file, just loaded as binary..):
The following content is a binary asset we created via code at runtime (it's "hello world" but creates as bytes array):
We can easily convert binary to string if we wanted, to show the original value:
The following is a code example on how to load a binary assets.
// load binary asset
let bin = await Shaku.assets.loadBinary("assets/data.bin");
// bin.data will contain a buffer of bytes with the loaded binary data
alert(bin.data);
// if your data is string, you can convert it to string:
alert(bin.string());