Skip to end of metadata
Go to start of metadata

Table of Contents

 

 


Application storage

Several means are available for an application to store data:

Storage
Advantages
Disadvantages
file in tmp:Files are read/writeContents are not retained when application exits

file in cachefs:

Beta feature

starting in Roku OS 8

Files are read/write; an arbitrary amount of data can be writtenData is evicted when more space is required for another Channel
file in pkg:Accesses any files included in app packageFiles are read-only
file on USB deviceAccesses files on removable USB mediaFiles are read-only; not all Roku models support USB
Registry

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.

Pathnames

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: 

device:/dir1/dir2/…/filename

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.

Examples

Example of path names used from BrightScript

 

theme.OverhangSliceSD = "pkg:/images/Overhang_Slice_SD43.png"
 
http.Http.GetToFile("tmp:/categorylist")
 
DeleteFile("tmp:/categorylist")
 
obj.SetCertificatesFile("common:/certs/ca-bundle.crt")
 
 

  • No labels