Skip to content

A JavaScript package for parsing EPUB files and extracting their contents.

Notifications You must be signed in to change notification settings

Downmoto/pubsie

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pubsie

A JavaScript package for parsing EPUB files and extracting their contents. This package provides a convenient way to extract metadata, chapters, and other resources from EPUB files in your JavaScript applications.

This package will aim to eventually adhere, in full, to the EPUB specifications documented here

Usage/Examples

const pubsie = require("pubsie");

let pub = new pubsie('path/to/epub');

pub.on("error", (err) => {
  console.log(err.message);

  if (err.data.name == "NoNcxError") {
    // ... process error
  };
});

pub.parse(); // always call after event listener

pub.buildCache('path/to/write/location') // build a cache of parsed data

console.log(pub.epub) // .epub property stores parsed data

Installation

Install pubsie with npm

  npm i pubsie

Running Tests

in tests directory, create a data directory and place epub files inside

tests
├───data
│   ├───moby-dick.epub
│   └───dracula.epub
└───global

To run tests, run the following command

  npm run test

Important

all epubs for testing are derived from Project Gutenberg

License

Pubsie is provided under the MIT license

Author

About

A JavaScript package for parsing EPUB files and extracting their contents.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published