(filePath: string)
| 8 | |
| 9 | export class DocParser implements FileParser { |
| 10 | async parseFile(filePath: string): Promise<FileParseResult> { |
| 11 | try { |
| 12 | if (!filePath) { |
| 13 | throw new Error('No file path provided') |
| 14 | } |
| 15 | |
| 16 | if (!existsSync(filePath)) { |
| 17 | throw new Error(`File not found: ${filePath}`) |
| 18 | } |
| 19 | |
| 20 | const buffer = await readFile(filePath) |
| 21 | return this.parseBuffer(buffer) |
| 22 | } catch (error) { |
| 23 | logger.error('DOC file parsing error:', error) |
| 24 | throw new Error(`Failed to parse DOC file: ${(error as Error).message}`) |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | async parseBuffer(buffer: Buffer): Promise<FileParseResult> { |
| 29 | try { |
nothing calls this directly
no test coverage detected