Skip to content

Function: mwFileFromUrl()

ts
function mwFileFromUrl(ctx: Context, url: string): Promise<MwFile>;

Defined in: src/file/getMwFile.tsx:357

Experimental

Fetch a file from a URL and return it as an MwFile.

Parameters

ParameterTypeDescription
ctxContextContext object.
urlstringURL of the file to fetch.

Returns

Promise<MwFile>

An MwFile with the file data and metadata.

Example

ts
const catalog = await mwFileFromUrl(ctx, 'https://shop.example.com/product-catalog.pdf');
console.log('Downloaded', catalog.name, '(' + catalog.type + ')');

Matterway Assistant SDK Documentation