Documentation / @agentick/shared / stringToMediaSource
Function: stringToMediaSource()
stringToMediaSource(
str,mimeType?):UrlSource|Base64Source
Defined in: blocks.ts:665
Create a MediaSource from a string (auto-detects URL vs base64).
Parameters
str
string
mimeType?
string
Returns
Example
typescript
const source = stringToMediaSource('https://example.com/image.png');
// { type: 'url', url: 'https://example.com/image.png' }
const source = stringToMediaSource('iVBORw0KGgo...');
// { type: 'base64', data: 'iVBORw0KGgo...' }