Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

459 B
Raw Blame
import { type DocumentChunk } from '../../types';

export const PPTXLoader = async (fileBlob: Blob | string): Promise<DocumentChunk[]> => {
  const { parseOfficeAsync } = await import('officeparser');

  const buffer =
    typeof fileBlob === 'string'
      ? Buffer.from(fileBlob)
      : Buffer.from(await fileBlob.arrayBuffer());

  const text = await parseOfficeAsync(buffer);

  return [
    {
      metadata: {},
      pageContent: text,
    },
  ];
};