Matterway
    Preparing search index...

    Function extractTextFromFiles

    • Extracts text content from a given file.

      This function supports extracting text from PDF and DOCX files. It throws an error if the file type is unsupported.

      Parameters

      • file: MwFile

        The file object of type MwFile containing the file's metadata and content.

      Returns Promise<string>

      A promise that resolves to the extracted text content as a string.

      If the file type is unsupported.

      const file: MwFile = { name: 'example.pdf', type: 'application/pdf', arrayBuffer: someBuffer };
      const text = await extractTextFromFiles(file);
      console.log(text);