@@ -117,7 +117,7 @@ declare namespace tailor.iconv {
117117 */
118118declare class TailorDBFileError extends Error {
119119 name : 'TailorDBFileError' ;
120- code ?: 'INVALID_PARAMS' | 'INVALID_DATA_TYPE' | 'OPERATION_FAILED' | 'DELETE_FAILED' | 'STREAM_OPEN_FAILED' | 'STREAM_READ_ERROR' | 'STREAM_ERROR' ;
120+ code ?: 'INVALID_PARAMS' | 'INVALID_DATA_TYPE' | 'OPERATION_FAILED' | 'DELETE_FAILED' | 'STREAM_OPEN_FAILED' | 'STREAM_READ_ERROR' | 'STREAM_ERROR' | 'FILE_TOO_LARGE' ;
121121 cause ?: unknown ;
122122}
123123
@@ -135,6 +135,8 @@ interface UploadMetadata {
135135interface DownloadMetadata {
136136 contentType : string ;
137137 fileSize : number ;
138+ sha256sum : string ;
139+ lastUploadedAt : string ;
138140}
139141
140142/**
@@ -179,6 +181,14 @@ interface FileDownloadResponse {
179181 metadata : DownloadMetadata ;
180182}
181183
184+ /**
185+ * Download as Base64 response interface
186+ */
187+ interface FileDownloadAsBase64Response {
188+ data : string ;
189+ metadata : DownloadMetadata ;
190+ }
191+
182192/**
183193 * Stream chunk types
184194 */
@@ -213,6 +223,7 @@ interface TailorDBFileAPI {
213223
214224 /**
215225 * Download a file from TailorDB
226+ * @throws {TailorDBFileError } FILE_TOO_LARGE if file exceeds 10MB - use openDownloadStream() for large files
216227 */
217228 download (
218229 namespace : string ,
@@ -221,6 +232,20 @@ interface TailorDBFileAPI {
221232 recordId : string
222233 ) : Promise < FileDownloadResponse > ;
223234
235+ /**
236+ * Download a file from TailorDB as Base64 string
237+ * Unlike download which returns decoded binary data (Uint8Array),
238+ * this returns the raw Base64-encoded string for use cases requiring
239+ * Base64 format (e.g., embedding in JSON responses, data URIs)
240+ * @throws {TailorDBFileError } FILE_TOO_LARGE if file exceeds 10MB - use openDownloadStream() for large files
241+ */
242+ downloadAsBase64 (
243+ namespace : string ,
244+ typeName : string ,
245+ fieldName : string ,
246+ recordId : string
247+ ) : Promise < FileDownloadAsBase64Response > ;
248+
224249 /**
225250 * Delete a file from TailorDB
226251 */
0 commit comments