Modules
Files
Uploads of players and files of the game: avatars, levels, replays. Every file gets an id when it is uploaded and keeps it for life, every other call reaches it by that id.
Uploading and reading
const file = await ansekai.storage.upload(blob, { name: "avatar.png", access: "public", folder: "avatars" });
await ansekai.data.set("avatar", file.id);
const bytes = await ansekai.storage.download(file.id);
image.src = ansekai.storage.publicUrl(file.id);replace puts new bytes under the same id, move puts the file in another folder. Keep the id in Player Data or the Realtime Database to find the file again. Folders only help people find files, a folder exists while a file is inside it.
Access
| Access | Who reads it |
|---|---|
| Private | Only the player who uploaded it |
| Players | Every signed in player of the game |
| Public | Anyone with the game key, it can sit in an image tag |
storage.url(id, { expiresIn }) gives a link that works without a key, for an hour by default and a week at most.
From server code
local file = ansekai.storage.info(id)
local text = ansekai.storage.read(id) -- 1 MB at most, as a string
local link = ansekai.storage.url(id, 600)
ansekai.storage.setAccess(id, "public")
ansekai.storage.delete(id)Settings
The settings of Files say what players can do from a game client. The panel and plugins reach every file whatever these say.
| Setting | Default |
|---|---|
| Players upload their own files | On, off means only the panel and plugins add files |
| Largest file | 10 MB, from 0.001 to 5,000 MB. The plan has the last word |
| Files of a player | 100, up to 10,000 |
| Access of a new file | Private |
Uploads that are off answer uploads_disabled, a file over the size file_too_large.
Cost
Keeping files counts against the cloud saves of the plan. What leaves the server costs $0.08 a GB.
Updated November 21, 2026