epub-ocf
Simple node.js library to read entries inside an epub container.
Installation
$ npm install --save epub-ocf
API
Creating container object
var ocf = ;var container = ; // ocf is an alias for ocf.zip
You can also create a container object from extracted epub directories.
var container = ocfdir'path/to/extracted/epub/directory/';
Or, epub directories served via http:
var container = ocf;
epub-ocf library can also guess which container method to use by examining the given uri.
// a Zip containerocf; // a Directory containerocf; // a Http containerocf;
There is also a sync
version of open
function.
var container = ocf;
Container methods
All container objects have readEntry
, createReadStream
and rootfiles
methods.
container.readEntry(entryPath, cb)
Returns the contents of entry.
container;
container.createReadStream(entryPath)
Creates a readable stream for the entry.
var stream = container;stream;
container.rootfiles(cb)
Returns an array of rootfiles by parsing the META-INF/container.xml
container;
Running the tests
$ git clone https://github.com/glkz/epub-ocf.git$ cd epub-ocf$ npm install$ npm test
License
See the LICENSE file.