Static files
Files in the static
directory of an Atmo project will be copied into the Runnable Bundle by subo
. Those files can then be accessed by Runnables. The directory is mounted as a sandboxed read-only filesystem.
- Rust
- JavaScript/TypeScript 🧪
- AssemblyScript 🧪
- Swift 🧪
In Rust these methods are available under the file
module:
# Use the "file" module
use suborbital::file;
# Invoke the "Get Static" method
file::get_static(…)
In JavaScript and TypeScript the methods live on the file
import:
import { file } from "@suborbital/runnable"
file.getStatic(…)
In Swift these methods are available individually:
// Invoke the "Get Static" method
Suborbital.GetStaticFile(…)
The following namespace methods are available:
Get Static​
Retrieves the contents of the static file with the given name:
- Rust
- JavaScript & TypeScript
- Swift
STATUS: STABLE
pub fn get_static(name: &str) -> Result<Vec<u8>, RunErr>
STATUS: BETA
// Get file contents as a string
file.getStatic(key: string): string
// Get raw byte contents
file.getStaticBytes(name: string): Uint8Array
STATUS: PREVIEW
public func GetStaticFile(name: String) -> String