Generate simple EPUB books with simple API in Node.js.
EpubGenerator = require('epub-generator')
Create and return an generator
. The generator is also a stream. You can pipe it to another stream (e.g. the stream returned by fs.createWriteStream
).
You need to listen to writableStream's events to get the generation status, such as drain
, error
, finish
, etc.
Options (all optional):
uuid
an identifier of the book, will generate one if not giventitle
the book's title, default to blanklanguage
language of the book, will try to detect system's default language or set to "en" if not givendate
the modification date, default to the current dateauthor
author of the bookdescription
some descriptionrights
rights informationcover
the cover image path, add the image using methods below
Add data
as a file in epub bundle. The data
can be a string, buffer, or stream.
path
is the file's path in epub bundle.
Hint: you can use XHTML, CSS and common images in epub bundle.
Meta (all optional):
mimetype
the mimetype to override the default mimetypetoc
whether this file should be added to TOC (table of contents)title
the title, used in TOC
Finish adding data. The callback
is added to the finish
event of the stream.
MIT