Skip to main content

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

NameOptionalityTypeDescription
objVerRequiredObjVerThe object version containing the file.
fileVerRequiredFileVerThe specific file version to download.

Return type

TypeDescription
Promise < string >Promise resolving to a data URI string (data:mime/type;base64,encodeddata).