Skip to content

loadFile

Copy as Markdown

const loadFile: (src, options?) => Promise<LoadResult>

Loads a .rupaplay file and validates it, without touching the page (to read a file, or check one before mounting it with mountFile).

FileSource

Where the file comes from: a URL, its bytes, a Response or a file already parsed (see FileSource).

LoadOptions

integrity: the file’s sha256-… hash, checked before the bytes are read.

Promise<LoadResult>

A promise of { file } or { error } (see FileErrorCode). It never rejects, and the call never throws.

import { loadFile } from "@rupamotion/player/file";
const { file, error } = await loadFile("/animations/hero.rupaplay");
if (error) console.warn(error.code, error.message);
else console.log(file.data.s.map(([name]) => name));