npm install https://github.com/heng1025/epub-parse.git
1.weixin miniprogram
import { parseEpubBook, loadEpubChapter, Epub } from '@heng1025/epub-parse';
- browser
<script src="../dist/index.umd.min.js"></script>
<script>
// ...global Epub
const {spine, manifest,packageDirectory,toc} = await Epub.parseEpubBook(epubUri);
let { rawTexts } = await Epub.loadEpubChapter(epub,chapterCount);
// ...
<script>
- parseEpubBook
function parseEpubBook(
rootURL: string,
): Promise<{
spine: Array<any>;
manifest: Array<any>;
packageDirectory: string;
toc: Array<any>;
}>;
- loadEpubChapter
export function loadEpubChapter(
epub: Epub,
chapterCount: number,
): Promise<{ rawText: string; formatTexts: string }>;
params | description |
---|---|
epubUri | container.xm path of epub file |
yarn demo
yarn watch