import { Book } from './types'; import { Parser, ParserInput, ParserOptions } from './parser'; export type ExportSectionUnit = 'section'; export type ExportSelectionType = 'first-sections'; export type ExportFormat = string; export interface ExportSelection { readonly type: ExportSelectionType; readonly count: number; readonly unit?: ExportSectionUnit; readonly includeNonLinear?: boolean; } export interface ExportOptions { /** Output format name. Defaults to EPUB for portable exports. */ format?: ExportFormat; /** Parser used when the source is a File, Blob, URL string, or ArrayBuffer. Defaults to the parser registry. */ parser?: Parser; /** Parser options used when parsing a raw source. */ parserOptions?: ParserOptions; /** Specific exporter instance to use instead of exporterRegistry lookup. */ exporter?: Exporter; /** Override the exported title. */ title?: string; /** Override the exported identifier. */ identifier?: string; } export interface ExportFirstSectionsOptions extends ExportOptions { /** * Unit used for extraction. * Currently only "section" is portable across parsers. For CBZ this is one * image page; for reflowable formats this is one spine/reading section, not * a renderer-layout visual page. */ unit?: ExportSectionUnit; /** Include non-linear sections such as notes. Defaults to false. */ includeNonLinear?: boolean; } export interface Exporter { readonly format: ExportFormat; readonly mediaType: string; readonly extension: string; canExport?(book: Book, selection: ExportSelection, options?: ExportOptions): Promise | boolean; exportBook(book: Book, selection: ExportSelection, options?: ExportOptions): Promise; } export type ExporterFactory = () => Exporter; export declare class ExporterRegistry { private exporters; register(format: string, factory: ExporterFactory): void; unregister(format: string): void; get(format: string): Exporter | undefined; list(): string[]; exportBook(book: Book, selection: ExportSelection, options?: ExportOptions): Promise; export(source: Book | ParserInput, selection: ExportSelection, options?: ExportOptions): Promise; } export declare const exporterRegistry: ExporterRegistry; export declare function exportBook(book: Book, selection: ExportSelection, options?: ExportOptions): Promise; export declare function exportBookAsBuffer(book: Book, selection: ExportSelection, options?: ExportOptions): Promise; export declare function exportFirstSections(source: Book | ParserInput, sectionCount: number, options?: ExportFirstSectionsOptions): Promise; export declare function exportFirstSectionsAsBuffer(source: Book | ParserInput, sectionCount: number, options?: ExportFirstSectionsOptions): Promise; export declare function firstSectionsSelection(sectionCount: number, options?: ExportFirstSectionsOptions): ExportSelection; export declare function isBook(value: unknown): value is Book; //# sourceMappingURL=exporter.d.ts.map