All Projects → gaoxiaoliangz → epub-parser

gaoxiaoliangz / epub-parser

Licence: other
A powerful yet easy-to-use epub parser

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to epub-parser

novelsave
This is a tool to download and convert novels from popular sites to e-books.
Stars: ✭ 25 (-75.73%)
Mutual labels:  epub
Wuxiaworld-2-eBook
This Python script will download chapters from novels availaible on wuxiaworld.com saves then into the .epub format
Stars: ✭ 90 (-12.62%)
Mutual labels:  epub
telegram
Golang Telegram Bot API
Stars: ✭ 13 (-87.38%)
Mutual labels:  lib
react-viewer
Online EPUB/Comics viewer
Stars: ✭ 52 (-49.51%)
Mutual labels:  epub
gostreamer
Go example that uses channels to build an execution pipeline
Stars: ✭ 75 (-27.18%)
Mutual labels:  lib
SDKLauncher-Android
Launcher app for Readium SDK on Android
Stars: ✭ 77 (-25.24%)
Mutual labels:  epub
dslibris
An ebook reader for the Nintendo DS, DS Lite, and DSi.
Stars: ✭ 31 (-69.9%)
Mutual labels:  epub
read-offline
Read Offline allows you to download or print posts and pages. You can download the post as PDF, ePub and mobi
Stars: ✭ 28 (-72.82%)
Mutual labels:  epub
calibre-kindle-comics
A calibre plugin that converts your comics into a readable format for kindle.
Stars: ✭ 32 (-68.93%)
Mutual labels:  epub
InMangaKindle
Descarga manga en español en diferentes formatos (PNG, PDF, EPUB, MOBI)
Stars: ✭ 43 (-58.25%)
Mutual labels:  epub
tgcalls
Voice chats, private incoming and outgoing calls in Telegram for Developers
Stars: ✭ 408 (+296.12%)
Mutual labels:  lib
metalsmith-imagemin
Metalsmith plugin to minify images
Stars: ✭ 17 (-83.5%)
Mutual labels:  lib
bash-pubkit
Book template and EPUB compiler
Stars: ✭ 27 (-73.79%)
Mutual labels:  epub
AltiumLibrary
Useful Altium pcb library (3D)
Stars: ✭ 33 (-67.96%)
Mutual labels:  lib
kaf-cli
把txt文本转成epub和mobi电子书的命令行工具(原TmdTextEpub)
Stars: ✭ 133 (+29.13%)
Mutual labels:  epub
scopy
Python script for searching through your digital books and cataloguing them in an easy-to-share list of files.
Stars: ✭ 28 (-72.82%)
Mutual labels:  epub
bitcoin-development-with-go
[Work in Progress] A little book on Bitcoin Development with Go (golang)
Stars: ✭ 19 (-81.55%)
Mutual labels:  epub
SunriseSunset
Java utility to calculate the time of sunrise and sunset for a given location.
Stars: ✭ 42 (-59.22%)
Mutual labels:  lib
epub3guide
台灣 EPUB3 制作指引
Stars: ✭ 95 (-7.77%)
Mutual labels:  epub
wattpad-downloader
A website to convert and download Wattpad stories into e-book reader formats.
Stars: ✭ 55 (-46.6%)
Mutual labels:  epub

📖 epub-parser

A powerful yet easy-to-use epub parser

npm version Test

The package exports a simple parser function which use epub file as input and output JavaScript object.

As it is written in TypeScript, types are already included in the package.

Install

npm install @gxl/epub-parser --save

or if you prefer yarn

yarn add @gxl/epub-parser

Usage

import { parseEpub } from '@gxl/epub-parser'

const epubObj = await parseEpub('/path/to/file.epub', {
  type: 'path',
})

console.log('epub content:', epubObj)

parseEpub(target: string | buffer, options?: object): EpubObject

target

type: string or buffer

It can be the path to the file or file's binary string or buffer

options

type: object

type(optional): 'binaryString' | 'path' | 'buffer'

It forces the parser to treat supplied target as the defined type, if not defined the parser itself will decide how to treat the file (useful when you are not sure if the path is valid).

EpubObject

The output is an object which contains structure, sections, info(private property names start with _. I don't recommend using them, since they are subscribed to change).

structure is the parsed toc of epub file, they contain information about how the book is constructed.

sections is an array of chapters or sections under chapters, they are referred in structure. Each section object contains the raw html string and a few handy methods.

  • Section.prototype.toMarkdown: convert to markdown object.
  • Section.prototype.toHtmlObjects: convert to html object. And a note about src and href, the src and href in raw html stay untouched, but the toHtmlObjects method resolves src to base64 string, and alters href so that they make sense in the parsed epub. And the parsed href is something like #{sectionId},{hash}.

How to contribute

  • Raise an issue in the issue section.
  • PRs are the best.

❤️

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].