Appearance
Function: extractTextFromFiles()
ts
function extractTextFromFiles(file: MwFile): Promise<string>;Defined in: src/file/getMwFile.tsx:470
Extract text content from a PDF or DOCX file.
Throw an error if the file type is not supported.
Parameters
| Parameter | Type | Description |
|---|---|---|
file | MwFile | The MwFile to extract text from. |
Returns
Promise<string>
The extracted text content as a string.
Throws
Error if the file type is unsupported.
Example
ts
const contract = await mwFileFromDrive('/Documents/contract.pdf', 'application/pdf');
const text = await extractTextFromFiles(contract);
console.log('Contract says:', text.slice(0, 200));