Skip to content

FileSource

Copy as Markdown

FileSource = string | URL | Blob | ArrayBuffer | ArrayBufferView | Response | RupaFile

What a load can be given:

  • a URL (string or URL): fetched, with credentials only to the page’s own origin (credentials: "same-origin"); from another origin the server must allow it (CORS);
  • the file’s bytes: a Blob (a File from an <input type="file">), an ArrayBuffer or a view of one;
  • a Response (from your own fetch), whose body is read;
  • a RupaFile already parsed (validated again; an integrity cannot be checked on it).
await loadFile("/animations/hero.rupaplay");
await loadFile(new URL("./hero.rupaplay", import.meta.url));
await loadFile(input.files![0]!);