{"library":"node-pptx-parser","title":"Node.js PowerPoint PPTX Parser","description":"node-pptx-parser is a Node.js library designed for parsing Microsoft PowerPoint (PPTX) files. It offers functionalities to extract text content while preserving its original formatting, including line breaks and paragraph structures, or to parse the entire PPTX document into manageable JavaScript objects. Currently at version 1.0.1, the library provides a Promise-based API for asynchronous operations and is written entirely in TypeScript, ensuring type safety for developers. Its key differentiators include the accurate preservation of text formatting, its modern Promise-based API, and its TypeScript foundation, making it robust for backend applications requiring reliable PPTX content extraction. While no explicit release cadence is stated, it adheres to standard semantic versioning practices.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install node-pptx-parser"],"cli":null},"imports":["import PptxParser from 'node-pptx-parser';","const PptxParser = require('node-pptx-parser').default;","import type { ParsedPresentation } from 'node-pptx-parser';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import PptxParser from 'node-pptx-parser';\nimport * as path from 'path';\nimport * as fs from 'fs';\n\nasync function main() {\n  const filePath = path.join(__dirname, 'example.pptx');\n\n  // Create a dummy pptx file for demonstration if it doesn't exist\n  // In a real scenario, this file would already be present.\n  if (!fs.existsSync(filePath)) {\n    console.log(`Please create a dummy 'example.pptx' file at ${filePath} for the quickstart to work.`);\n    console.log('Skipping text extraction example.');\n    return;\n  }\n\n  const parser = new PptxParser(filePath);\n\n  try {\n    // Extract text from all slides\n    const textContent = await parser.extractText();\n\n    // Print text from each slide\n    textContent.forEach((slide) => {\n      console.log(`\\nSlide ${slide.id}:`);\n      console.log(slide.text.join('\\n'));\n    });\n\n    // Example of full parsing\n    const parsedContent = await parser.parse();\n    console.log('\\nFull presentation structure parsed. Example slide 1 content:', parsedContent.slides[0]?.parsed);\n\n  } catch (error: any) {\n    console.error('Error during PPTX parsing:', error.message);\n    if (error.message.includes('Invalid PPTX file structure')) {\n      console.error('Ensure example.pptx is a valid PowerPoint file.');\n    }\n  }\n}\n\nmain();","lang":"typescript","description":"Demonstrates how to initialize PptxParser with a file path and extract text content from all slides, as well as initiating a full presentation parse.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}