UNPKG

@mastra/core

Version:
41 lines (38 loc) 1.29 kB
'use strict'; var providerUtilsV5 = require('@ai-sdk/provider-utils-v5'); // src/stream/aisdk/v5/file.ts var DefaultGeneratedFile = class { base64Data; uint8ArrayData; mediaType; constructor({ data, mediaType }) { const isUint8Array = data instanceof Uint8Array; this.base64Data = isUint8Array ? void 0 : data; this.uint8ArrayData = isUint8Array ? data : void 0; this.mediaType = mediaType; } // lazy conversion with caching to avoid unnecessary conversion overhead: get base64() { if (this.base64Data == null) { this.base64Data = providerUtilsV5.convertUint8ArrayToBase64(this.uint8ArrayData); } return this.base64Data; } // lazy conversion with caching to avoid unnecessary conversion overhead: get uint8Array() { if (this.uint8ArrayData == null) { this.uint8ArrayData = providerUtilsV5.convertBase64ToUint8Array(this.base64Data); } return this.uint8ArrayData; } }; var DefaultGeneratedFileWithType = class extends DefaultGeneratedFile { type = "file"; constructor(options) { super(options); } }; exports.DefaultGeneratedFile = DefaultGeneratedFile; exports.DefaultGeneratedFileWithType = DefaultGeneratedFileWithType; //# sourceMappingURL=chunk-PUEQNTX6.cjs.map //# sourceMappingURL=chunk-PUEQNTX6.cjs.map