json-to-epub
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

JSON to Epub

The library will read JSON files from folders and generate epub file.

Setup

Prepare folder with structure:

/
 manifest.js // content book manifest
 chapter1.json // any file name you want
 chapter2.json
 ...

run npx json-to-epub


manifest.js

module.exports = {
    title: "Book title",
    author: "Manh Lai",
    publisher: "sample publisher";
    output: "./",
    bookName: "sample.epub",
}
  • title: Title of the book
  • author: Name of the author for the book, string or array, eg. "Alice" or ["Alice", "Bob"]
  • publisher: Publisher name (optional)
  • cover: Book cover image (optional), File path (absolute path) or web url, eg. "http://abc.com/book-cover.jpg" or "/User/Alice/images/book-cover.jpg"
  • output Out put path (relative path)
  • bookName Out put file name

chapter2.json

{
    "title": "About the author",
    "author": "John Doe",
    "order": 1,
    "data": "<h2>Charles Lutwidge Dodgson</h2><div lang=\"en\">Better known by the pen name Lewis Carroll...</div>"
}
  • title: optional, Chapter title
  • author: optional, if each book author is different, you can fill it.
  • order: optional, determine chapter order. default, chapters are sorted by file name.
  • data: required, HTML String of the chapter content. image paths should be absolute path (should start with "http" or "https"), so that they could be downloaded. With the upgrade is possible to use local images (for this the path must start with file: //)

Readme

Keywords

none

Package Sidebar

Install

npm i json-to-epub

Weekly Downloads

1

Version

1.1.1

License

Apache-2.0

Unpacked Size

27.3 kB

Total Files

30

Last publish

Collaborators

  • laituanmanh32