1.0.1 • Published 10 years ago
epub-generator v1.0.1
epub-generator
Generate simple EPUB books with simple API in Node.js.
API
EpubGenerator = require('epub-generator')
EpubGenerator( options )
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):
- uuidan identifier of the book, will generate one if not given
- titlethe book's title, default to blank
- languagelanguage of the book, will try to detect system's default language or set to "en" if not given
- datethe modification date, default to the current date
- authorauthor of the book
- descriptionsome description
- rightsrights information
- coverthe cover image path, add the image using methods below
generator.add( path, data, meta )
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):
- mimetypethe mimetype to override the default mimetype
- tocwhether this file should be added to TOC (table of contents)
- titlethe title, used in TOC
generator.end( callback )
Finish adding data. The callback is added to the finish event of the stream.
LICENSE
MIT