loadFile
Copy as Markdown
constloadFile: (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).
Parameters
Section titled “Parameters”Where the file comes from: a URL, its bytes, a Response or a file already parsed (see FileSource).
options?
Section titled “options?”integrity: the file’s sha256-… hash, checked before the bytes are read.
Returns
Section titled “Returns”Promise<LoadResult>
A promise of { file } or { error } (see FileErrorCode). It never rejects, and the call never throws.
Example
Section titled “Example”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));