epubstream

0.1.3 • Public • Published

epubstream

DESCRIPTION

Epubstream is a module for generating epub2 files directly to a writable stream.

USAGE

var epubstream = require('epubstream'),
    fs = require('fs');

// Create epub and provide the minimum possible metadata
var epub = epubstream.createEpub({
    title: 'Sample',
    nav: [{ label: 'foo', content: 'foo.html' }]
});

// Start piping the epub to a file
epub.pipe(fs.createWriteStream('sample.epub'));

// Add the file foo.xhtml to the archive
epub.addFile(fs.createReadStream('foo.xhtml'), 'foo.xhtml', function() {
    // Write the XML files required for epub (ncx/opf/ocf)
    epub.finalize(function(b) { console.log('%d bytes', b); });
});

LIMITATIONS

Files added to an epub are passed through unmodified, so you must ensure that your XHTML files comply with the Epub2 specification.

Readme

Keywords

none

Package Sidebar

Install

npm i epubstream

Weekly Downloads

0

Version

0.1.3

License

none

Last publish

Collaborators

  • contentment