Skip to content

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

ParameterTypeDescription
fileMwFileThe 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));

Matterway Assistant SDK Documentation