DownloadFileAsDataUri
Description
Downloads a file from an object as a base64-encoded data URI.
Retrieves the content of a specific file version from a vault object and returns it as a data URI string with base64 encoding. This is useful for embedding file content directly in HTML or passing file data as strings.
Files larger than 64MB are rejected to prevent memory exhaustion.
Syntax
// ICommonFunctions is binded into the MFiles global object
const result = await MFiles.DownloadFileAsDataUri(objVer, fileVer);
Parameters
| Name | Optionality | Type | Description |
|---|---|---|---|
| objVer | Required | ObjVer | The object version containing the file. |
| fileVer | Required | FileVer | The specific file version to download. |
Return type
| Type | Description |
|---|---|
Promise < string > | Promise resolving to a data URI string (data:mime/type;base64,encodeddata). |