json-to-epub
v1.1.2
Published
generate epub file from config
Downloads
253
Readme
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 bookauthor
: 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 titleauthor
: 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: //)