Skip to content
Ali Hussain edited this page Sep 28, 2023 · 1 revision

Stream Files

Unlike non-stream files the maximum size doesn't need to be known on boot - for stream files, there are no size limitations, and the size doesn't need to be known until it is loaded!

Here's is what a stream callback looks like:

use arcropolis_api::stream_callback;

#[stream_callback]
fn my_callback(hash: u64) -> T {
    // ...
}

It takes a hash of the full path and returns any of the following:

  • PathBuf - A path to a file on the sd card to load
  • String - A path to a file on the sd card to load
  • Vec<u8> - the contents of the file (note: if the file is on SD, this will be less efficient)
  • Option<T> where T is any of the types in this list*
  • Result<T, E> where T is any of the types in this list*

* When None/Err is returned, Arcropolis will load the file from the SD card (if available) or from the vanilla data.arc