gi-nx / getTempUrl
ts
const getTempUrl: (...args: [string]) => Promise<string> = cachedGetTempUrl;get a temporary (valid for 60s) URL to access resources (files, content library packs, project attachments, etc.). Works for urls of the form /api/storage-proxy/...
Parameters
| Parameter | Type |
|---|---|
...args | [string] |
Returns
Promise<string>
temporary URL
Remarks
The app URL needs to be whitelisted before it can access the temporary public URLs. Contact us for details.
Example
tsx
const files = await rpc.invoke("fetchUserFiles");
const firstFileUrl = await rpc.invoke("getTempUrl", files[0].url);
// firstFileUrl can now be used directly in <img src={...} />, fetch(), etc.