ablo.images.upload() with raw bytes and a MIME type, and the SDK uploads the file to Ablo’s hosted storage on your behalf. You get back a CDN URL that you can drop straight into any image() layer or { type: 'image', url } layer definition.
The upload method
Returns:
organizationId.
Supported MIME types
ThecontentType field must be one of the following values (the ImageMime type):
Reading from the filesystem (Node.js)
UsereadFileSync to load the file into a Buffer, then wrap it in Uint8Array before passing it to upload().
Reading from a browser File input
In the browser, convert theFile to an ArrayBuffer using file.arrayBuffer(), then pass it directly — no Uint8Array wrapper needed.
The browser’s
File.type property is a string, so you will need to cast it to ImageMime. If you want runtime safety, validate it against the IMAGE_MIME_TYPES array exported from @abloatai/decks before the upload call.Using an existing public URL
If your image is already publicly accessible on the internet, you do not need to upload it at all. Pass the URL directly to theimage() builder or inline { type: 'image', url }. Ablo will auto-rehost it at render time if needed.
Uploading before creating a deck
You can upload images before you begin building your deck, then reference the returned URLs insidedecks.create(). This is useful when you have multiple images to upload in parallel.
Scoping uploads to a deck
PassdeckId to associate the upload with a specific deck. This scopes the stored file under that deck, making it easier to reason about which assets belong to which presentation.