UNPKG

@aidalinfo/office-to-markdown

Version:

Modern TypeScript library for converting Office documents (DOCX) to Markdown format, optimized for Bun runtime with enhanced table support and math equation conversion.

43 lines 1.72 kB
import type { ConvertibleSource, ConverterOptions } from "../types/converter.js"; import type { DocumentConverterResult } from "../types/result.js"; import type { StreamInfo } from "../types/stream-info.js"; /** * Abstract base class for all document converters. */ export declare abstract class DocumentConverter { /** * Determine if this converter can handle the given file. * * @param buffer - The file data as a buffer * @param streamInfo - Information about the file * @param options - Conversion options * @returns True if this converter can handle the file */ abstract accepts(buffer: Buffer, streamInfo: StreamInfo, options?: ConverterOptions): boolean; /** * Convert the file to Markdown. * * @param buffer - The file data as a buffer * @param streamInfo - Information about the file * @param options - Conversion options * @returns The conversion result */ abstract convert(buffer: Buffer, streamInfo: StreamInfo, options?: ConverterOptions): Promise<DocumentConverterResult>; /** * Helper method to convert various source types to Buffer. */ protected sourceToBuffer(source: ConvertibleSource): Promise<Buffer>; /** * Type guard to check if source is a FileSource. */ private isFileSource; /** * Helper method to infer stream info from various sources. */ protected inferStreamInfo(source: ConvertibleSource, providedInfo?: Partial<StreamInfo>): StreamInfo; /** * Helper method to guess MIME type from file extension. */ protected guessMimeTypeFromExtension(extension: string): string | undefined; } //# sourceMappingURL=base-converter.d.ts.map