UNPKG

@publiwrite/html-to-epub

Version:

A library to generate EPUB from HTML. Inspired by epub-gen.

97 lines (96 loc) 2.42 kB
export interface EpubContentOptions { title: string; data: string; url?: string; author?: Array<string> | string; filename?: string; excludeFromToc?: boolean; beforeToc?: boolean; ornamentalBreakElement?: string; } export interface EpubOptions { title: string; description: string; cover?: string; publisher?: string; author?: Array<string> | string; tocTitle?: string; appendChapterTitles?: boolean; date?: string; lang?: string; css?: string; fonts?: string[]; content: EpubContentOptions[]; customOpfTemplatePath?: string; customNcxTocTemplatePath?: string; customHtmlTocTemplatePath?: string; customHtmlCoverTemplatePath?: string; customHtmlContentTemplatePath?: string; version?: number; userAgent?: string; verbose?: boolean; tempDir?: string; } interface EpubContent { id: string; href: string; title: string; data: string; url: string | null; author: Array<string>; filePath: string; templatePath: string; excludeFromToc: boolean; beforeToc: boolean; ornamentalBreakElement: string | null; } interface EpubImage { id: string; url: string; dir: string; mediaType: string; extension: string; } export declare class EPub { uuid: string; title: string; description: string; cover: string | null; coverMediaType: string | null; coverExtension: string | null; coverDimensions: { width: number; height: number; }; publisher: string; author: Array<string>; tocTitle: string; appendChapterTitles: boolean; date: string; lang: string; css: string | null; fonts: Array<string>; content: Array<EpubContent>; images: Array<EpubImage>; customOpfTemplatePath: string | null; customNcxTocTemplatePath: string | null; customHtmlCoverTemplatePath: string | null; customHtmlContentTemplatePath: string | null; customHtmlTocTemplatePath: string | null; version: number; userAgent: string; verbose: boolean; tempDir: string; tempEpubDir: string; output: string; constructor(options: EpubOptions, output: string); render(): Promise<{ result: string; }>; private generateTempFile; private makeCover; private downloadImage; private downloadAllImage; private generate; } export {};