Several means are available for an application to store data:
|file in tmp:||Files are read/write||Contents are not retained when application exits|
file in cachefs:
starting in Roku OS 8
|Files are read/write; an arbitrary amount of data can be written||Data is evicted when more space is required for another Channel|
|file in pkg:||Accesses any files included in app package||Files are read-only|
|file on USB device||Accesses files on removable USB media||Files are read-only; not all Roku models support USB|
Data is read/write; data is retained when the application
exits and when the system reboots.
|Data size is limited. Each channel has access to only 16kb of registry space.|
[BETA] Cachefs: Description
Available in Roku OS 8
Developers can use the cachefs: file system to allow applications to cache data to volatile or persistent storage instead of tmp:. End-users can add an external SD card to their device which will preserve the data even after a system reboot and improve performance. Users without extended storage also benefit from the use of a shared in-memory cache that is automatically managed by the system to optimize for the most recently used assets.
Note that the OS can evict the data at any time, such as when another channel decides to write so much data that space is required. Thus, a channel should always check for the existence of the file they wrote to before relying on the data cache.
Depending on your application's requirements, you can choose one of these options. Interfaces to the registry are documented at roRegistry. Interfaces to files are described below.
A Roku Streaming Player Pathname identifies a file. Pathnames are used in ifFileSystem methods, as well as in other components which use files. A Pathname is a string with the following format:
The device field (sometimes called PHY) identifies the location of the file and can be one of:
- tmp - Temporary file storage device for the application
- pkg - The root of the application directory that provides read-only access to files provided in the pkg
Since Firmware version 2.6:
- common – A common read-only filesystem that all plugins have access to. Currently, it only contains a CA certificate bundle that contains CA certs trusted by FireFox (common:/certs/ca-bundle.crt). You are encouraged to use this file in your apps, especially if you are aggregating many different feeds. Please see the twitterOAuth sample application for a usage example.
- ext1, ext2, …,ext9 – Storage devices recognized on the USB bus. Please see the USB player sample application for a usage example.
There is no concept of a current working directory or relative paths. All path names must use the absolute Roku Streaming Player Pathname format above.
The filename components in a pathname may not contain any of these characters:
< > : " / | ? *
nor any whitespace or non-printable character.