ctx.files
Files on this person’s Fave1 account — the screenshot they marked up, the board they exported, the images they kept. Theirs alone, on every site and in app mode.
Calls
await ctx.files.put(blob, { name }); // → FileInfo, up to 25 MB await ctx.files.put(blob, { name, onProgress: (sent) => bar(sent) }); // sent goes 0 → 1 while it uploads await ctx.files.get(id); // → Blob, or null when it's gone await ctx.files.list(); // → FileInfo[], newest first — up to 5,000 await ctx.files.delete(id); // resolves even if it was already gone ctx.files.manage(); // Fave1 Settings › Storage, at your app
{
id: '4c1f9a2e-…', // opaque
name: 'amazon.com.png', // opts.name, else a File's own name, else ''
type: 'image/png', // the blob's type, lowercased — get() uses it
size: 284113, // bytes
createdAt: '2026-10-04T09:12:40.000Z',
}Give the blob its type when you make it — canvas.toBlob(cb, 'image/png'), new Blob([csv], { type: 'text/csv' }). It’s kept lowercased, without parameters (image/PNG; x=1 is saved as image/png), and get() hands the blob back with that type. No type at all means application/octet-stream. Pass a File — from a file input or a drop — and its own name comes along unless you give one. Names can be up to 200 characters; longer ones are cut.
One permission: storage
Files come with the permission you already declare for ctx.storage. People read the same sentence — “Remembers what you save” — and one switch covers both. ctx.can('storage') answers for files too: false when nobody’s signed in, or when they switched it off. Switched off, every call rejects with denied and the files stay put; removing your app deletes them.
Bytes here, the list in storage
The bytes
Anything big or binary — images, PDFs, exports. Up to 25 MB each.
The list
Which files, in what order, with what labels — and your settings. JSON, 64 KB a value.
type Shot = { id: string; site: string }; Fave1.defineApp({ async onLaunch(ctx) { if (!ctx.can('storage')) { ctx.ui.render([ctx.ui.text('Sign in to Fave1 to keep your shots.')]); return; } let shots = ((await ctx.storage.get('shots')) as Shot[] | undefined) ?? []; async function keep(png: Blob) { const file = await ctx.files.put(png, { name: `${ctx.page.title}.png` }); shots = [{ id: file.id, site: new URL(ctx.page.url).hostname }, ...shots]; await ctx.storage.set('shots', shots); } async function show(shot: Shot, img: HTMLImageElement) { const blob = await ctx.files.get(shot.id); if (!blob) { // They deleted it in Settings › Storage. Drop it — don't fail. shots = shots.filter((s) => s.id !== shot.id); await ctx.storage.set('shots', shots); return; } const url = URL.createObjectURL(blob); img.onload = img.onerror = () => URL.revokeObjectURL(url); // done with it img.src = url; } }, });
Showing a file
A file has no link of its own. It only comes back as a Blob from get(), and Fave1 won’t open its bytes as a page. To show one, make an object URL, hand it to an <img>, and revoke it as soon as the image loads or fails. Don’t keep the URL around — when you draw it again, make a new one from the Blob.
Get files as they come into view, not hundreds at once. Reads have a limit too: 600 get() calls a minute per person, all apps together. Past it, get() rejects with rate and err.scope is 'read' — it clears within the minute, so back off and try again shortly. list() doesn’t count. An older runtime may leave the scope out; from get(), read that as 'read'.
async function draw(img: HTMLImageElement, id: string) { const blob = await ctx.files.get(id); if (!blob) return; // they cleared it const url = URL.createObjectURL(blob); img.onload = img.onerror = () => URL.revokeObjectURL(url); img.src = url; }
They can clear it any time
Fave1 Settings › Storage shows people what each app keeps — how much, and which files — and lets them delete any of it, or everything your app saved, whenever they like. Your app isn’t told.
So a file can be gone: get() resolves null. Drop it from your list, or show it as removed. A key in ctx.storage can be gone too, your index included — treat undefined like a first run. And an index can point at files that aren’t there anymore.
Their storage, and when it’s full
Everything your app saves counts toward the person’s Fave1 storage — data and files from every app, one number. Each person has their own amount; it starts at 1 GB. When it’s full, new saves reject with quota — put() here, set() in ctx.storage. For files the scope is always 'account'; ctx.storage can also say 'app' for your app’s own share — 1 MB on Free, 10 MB on paid plans (When it’s full). Reading and deleting always work.
try {
await ctx.files.put(png, { name: 'board.png' });
} catch (err) {
if ((err as Fave1Error).code === 'quota') {
ctx.ui.render([
ctx.ui.text('Your Fave1 storage is full.'),
ctx.ui.button('Make room', { onClick: () => ctx.files.manage() }),
]);
}
}manage() opens your app’s page in their Fave1 Settings › Storage in a new tab — everything you keep, file by file, ready to clear.
Uploads have two limits, all apps together: 600 files an hour, and 3,000 in 30 days on Free (paid plans get more). Deleting a file doesn’t give the upload back. Past either, put() rejects with rate, and err.scope says which — 'hour': try again in a bit; 'month': it won’t clear today, so tell them. An older runtime may leave the scope out; from put(), read that as 'hour'. An app that uploads a lot — a backup, an import — should stop at rate, keep its place, and pick up later.
The first use on a site
Same as ctx.storage: the first time your app touches the account from a site, Fave1 asks once in your panel — Use your Fave1 account here? One answer opens ctx.storage, ctx.files and ctx.pub on that site. In app mode it never asks. The first call can wait on that answer, and can reject with cancelled.
Private to them
Nobody else can read these files — not other apps, not other people, not you. There’s no developer view of what people saved: your code reads it on their device, with their session, and a file shows only inside your app (Showing a file).
Errors
storage isn’t in your manifest, or they switched it offctx.perms.open()err.scope is 'account'ctx.files.manage()err.scope is 'hour' or 'month'. Reads: 600 get() calls in a minute — err.scope is 'read'. All apps togetherresume laterput · get, 15 seconds for the restretryWhile you build
fave1 dev or a review link, ctx.files keeps files in this browser, on this site — nothing touches your real account, or anyone’s storage. Switch Data to My account to upload to a DEV slot on your own account.To try your full-storage screen, give the sandbox a size. Once what it holds on that site — files and data — passes it, put() rejects with quota, scope 'account'. To try the monthly upload limit, give it a count: past that many uploads in 30 days (deleted ones count), put() rejects with rate, scope 'month'.
localStorage.setItem('fave1.dev.quota', '200000'); // bytes localStorage.removeItem('fave1.dev.quota'); // back to no account limit localStorage.setItem('fave1.dev.uploads', '5'); // uploads in 30 days localStorage.removeItem('fave1.dev.uploads'); // back to no count