public (accessible via a permanent URL) or private (accessible only via a time-limited signed URL).
Each file operation is available in two forms:
- Client (
modelence/client) — call directly from the browser via built-in methods - Server (
modelence/server) — call from your server-side code (e.g. inside a mutation or cron job)
Uploading a File
- Client
- Server
uploadFile takes a File or Blob, requests a presigned upload URL from the backend, then POSTs the file directly to storage using a signed form:visibility field controls access:
"public"— the file is accessible via a permanent URL"private"— the file requires a signed URL to access
Getting a File URL
Returns a URL for displaying or linking to a file. For public files this is a permanent URL; for private files it is a time-limited presigned URL.- Client
- Server
Downloading a File
Returns a presigned download URL for a private file.- Client
- Server
Deleting a File
- Client
- Server
File Paths
File paths always include the visibility prefix:public/<path> or private/<path>. The upload functions return the full filePath (including prefix) in their result, which you can store and pass to the other functions.