Skip to content

Function: mwFileFromDrive()

ts
function mwFileFromDrive(filepath: string, type: string): Promise<MwFile>;

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

Experimental

Read a file from the local file system and return it as an MwFile.

Parameters

ParameterTypeDescription
filepathstringPath to the file on disk.
typestringMIME type of the file.

Returns

Promise<MwFile>

An MwFile with the file data and metadata.

Example

ts
const spreadsheet = await mwFileFromDrive(
  '/Users/me/Downloads/quarterly-sales.xlsx',
  'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
);
console.log('Loaded', spreadsheet.name, 'from Downloads');

Matterway Assistant SDK Documentation