Skip to content

MediaApi

Defined in: packages/sdk/src/resources/MediaApi.ts:9

Per-website image uploads. Writes into the site repo at public/uploads/{timestamp}-{filename}; bounded by GitHub’s file-size limit (we cap at 8 MB) and refuses deletes outside that prefix.

  • Resource

new MediaApi(opts): MediaApi

Defined in: packages/sdk/src/request.ts:93

VantageClientOptions

MediaApi

Resource.constructor

delete(websiteId, path): Promise<{ ok: true; path: string; }>

Defined in: packages/sdk/src/resources/MediaApi.ts:30

Delete a previously-uploaded image. path must be under public/uploads/ (the API refuses anything else).

string

string

Promise<{ ok: true; path: string; }>


upload(websiteId, input): Promise<{ bytes: number; path: string; url: string; }>

Defined in: packages/sdk/src/resources/MediaApi.ts:16

Upload an image into the website’s repo at public/uploads/{timestamp}-{filename}. Max 8 MB. Returns the public URL the live site will serve it at + the in-repo path (useful for referencing it from a CMS field).

string

string

string

string

Promise<{ bytes: number; path: string; url: string; }>