quick-epub: Quickly generate valid EPUB 3.0.1 documents

quick-epub is a library written in Node.js that generates valid EPUB 3.0.1 documents. It is derived from cyrilis’ epub-gen as a proof of concept, rather than an actual library. It was mainly used to learn about the EPUB specification, set out by the International Digital Publishing Forum.

This will generate an EPUB file with a table of contents included, which proves for easy browsing by chapter on an e-book reader. It has been tested on a Kindle Paperwhite, and should work on most e-book readers.

As this library is a proof of concept, it has zero error handling and will not validate anything that is passed to it. The resultant documents can be checked against epubcheck which validates documents against the EPUB specification. Invalid HTML markup passed to this library will result in failed checks by the above checker. Therefore, it is recommended that content is sanitized prior to passing to the library.


npm install quick-epub --save


var epub = require("quick-epub");


Creates a file with a given data object, which is described below in detail.

  .then(function() {
    console.log("book done.");
  .catch(function(error) {

Data Object

The properties of the data object should be:

  • output Filepath/name of file. Default: Some tempDir folder just above the node_modules dir.
  • title Title of the book
  • author Name of author. Can be either string or array.
  • contents Array of chapter objects.
  • publisher Whoever published this fantastic EPUB book. (Optional)
  • description Self-explanatory. (Optional)
  • appendChapterTitles Append the chapter title at the beginning of each chapter. Default: false (Optional)
  • dates (Optional) Do you know when this was published/modified? Good. Chuck it in. ISO-8601 format!
    • published
    • modified
  • lang Language. Default: en (Optional)
  • identifiers

contents is an array filled with chapter objects with the following structure:

    id: Number,
    title: String,
    data: String

Data Object Example

var data = {
  lang: "engrish",
  title: "Sample Title",
  author: ["Author One", "Author Two"],
  publisher: "Sample Publisher",
  description: "Something to describe, I guess.",
  contents: [
    { title: "First Title", data: "Initial Data", id: 1 },
    { title: "II. 2.", data: "Second Data", id: 2 },
    { title: "3 a.k.a THREE", data: "Third Lot of Data.", id: 3 }
  identifiers: {
    isbn10: "this is definitely not a valid ISBN-10 number",
    isbn13: "nor is this a valid ISBN-13 number",
    doi: "yep. not valid either."
  dates: {
    published: new Date().toISOString().split(".")[0] + "Z",
    modified: new Date().toISOString().split(".")[0] + "Z"
  appendChapterTitles: true,
  output: "yolo.epub"


quick-epub is released under the MIT License. See LICENSE.md

Fork me on GitHub