Osy#betaa language · its runtime Osyrin · a hosted platform
Why Osy#Built for agentsAgents as declarationsWorkflows that waitRuns exactly onceSecure by defaultNothing to mockThe editor is the compilerUI in the languageDocuments are dataOne program

Reference / Storage

Files (addressing something the app stores)

The platform stores a file two ways, and which one you hold decides how you address it. A PATH-keyed file lives at an address you chose and becomes a URL with `File.Url` (public) or `File.SignedUrl` (a time-limited grant to one caller). A `FileAsset` is a ROW with its own security and NO path at all — neither of those verbs can address one; you put it on a page with `Image(fileAsset: row.Photo.Id)` and the platform works the address out.

stable1 example compiled by CIstoragefilesovervieworientation

Summary#

There are two stores, and the first thing to know is which one you are holding.

what you havehow it is addressedshown with
a path"public/logo.png", an upload resultFile.Url(path) · File.SignedUrl(path)Image(src: File.Url(path))
a FileAsset — a row, from File.Create or Image.Thumbnail, or a FileAsset fieldit has no path; the platform addresses itImage(fileAsset: row.Photo.Id) — see Showing a picture on a page

⚠ The verbs on this page take a path string. A FileAsset carries none, so File.Url(asset) and File.SignedUrl(asset) do not exist and the compiler refuses them — that is the commonest first-day mistake, and Showing a picture on a page is what you wanted.

Within the path store, a stored file is addressed by URL, and which URL you ask for is an access decision.

using Osysharp.Storage;

[Principal] entity User { [MaxLength(200)] string Email; }

entity Item { [Required, MaxLength(200)] string ImagePath; }

// Anyone may fetch this — it is an asset, served to whoever asks.
string PublicImage(Item item) { return File.Url(item.ImagePath); }

// This one belongs to somebody, so the URL carries its own expiring grant.
string PrivateReport(User user) { return File.SignedUrl("reports/" + user.Id + "/q3.pdf"); }

Description#

File.Url is pure sugar over the serving route — an app-relative path becomes /_osy/files/…, which means it works directly inside a render argument. It grants nothing: what it addresses is served to whoever asks, so it is right for assets and wrong for anything a person owns.

File.SignedUrl is the other case, and it is the one to reach for by default when the file belongs to somebody: the URL carries its own time-limited grant, so sharing it is a decision with an expiry rather than a permanent one.

See also#

Related

File.Url

Turns an app-relative file path into the public URL a browser can fetch it from — `File.Url("public/x.png")` returns…

File.SignedUrl

Mints a temporary, signed URL that lets an authorized browser fetch a PRIVATE app file — one stored outside `public/` —…

Image.Thumbnail, Resize and Convert (a stored image, transformed)

Three server-side transforms over a stored image, each answering a NEW `FileAsset`: `Thumbnail` fits the image within…

Showing a picture on a page

`Image` is the element that shows a picture, and it addresses one of two ways. `src` takes a URL — for a file in the…