epubstream

Epub

npm install epubstream
24 downloads in the last day
51 downloads in the last week
220 downloads in the last month

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.

npm loves you