Files
Every file is a typed record in your schema.
Clients upload bytes straight to object storage. Napalm checks file size and format before marking the record ready, and edge caches serve downloads.
Read the files docsDirect uploads
Clients upload straight to storage.
Insert a file record setting file_size and select file_upload in one statement. The query returns a presigned upload plan to the caller, and browsers or mobile apps send bytes straight to object storage.
File upload protocolselect (insert Scan { owner := global caller, file_name := <str>$name, file_size := <int64>$size,}) { id, file_upload }Upload checks
Napalm verifies every upload.
A JPEG renamed contract.pdf never becomes Ready. On completion, Napalm checks the byte length and reads the file format from the uploaded bytes. Rejected uploads are deleted.
using extension files; type ContractPdf extending ext::files::File { required deal: Deal; constraint expression on (.file_format = ext::files::Format.Pdf); access policy deal_members allow select, insert using ((global caller in .deal.team.members) ?? false);}Public files
Serve public files on custom domains.
Overload file_is_public on avatars or catalog media for permanent unsigned URLs, and bind a custom domain over automatic TLS. Public uploads still pass your access rules and format constraints.
type Avatar extending ext::files::File { overloaded required file_is_public: bool { default := true; }; required owner: ext::auth::Identity;}Download links
Download links arrive in your query result.
Select file_url beside your other fields in the same query. Napalm signs private URLs only for records the caller’s access policy admits, and each link stays valid for 6 hours from the nearest edge.
Files and object storageselect Note { title, attachments: { file_name, file_size, file_url, } filter .file_status = ext::files::Status.Ready,}Resumable uploads
Large files upload in verified parts.
napalm.upload splits multi-gigabyte videos and datasets across presigned multipart URLs, tracks upload progress and verifies the bytes on completion.
const { data } = await db.POST('/query/addScan', { body: { variables: { name: file.name, size: file.size } },})const verified = await napalm.upload(data.data[0].file_upload, file, { onProgress: (sent, total) => setProgress(sent / total),})Edge delivery
File downloads cost $0.04 per gigabyte.
Every month includes 500 GB of download bandwidth. Popular objects cache at edge locations near your readers. Deleted files remain in storage until your oldest backup expires, so a branch restore never leaves broken links.
$0.04 / GBfile download bandwidth past 500 GB a month