Socket
Book a DemoInstallSign in
Socket

json-to-epub

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-to-epub

generate epub file from config

latest
npmnpm
Version
1.1.2
Version published
Weekly downloads
0
-100%
Maintainers
0
Weekly downloads
 
Created
Source

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: //)

FAQs

Package last updated on 19 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts