Appearance
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
| Parameter | Type | Description |
|---|---|---|
filepath | string | Path to the file on disk. |
type | string | MIME 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');