EPUBToText is a node.js module to convert EPUB files to plain text chapters
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.gitignore
LICENSE.txt
README.md
index.js
package.json

README.md

EPUBToText

EPUBToText is a node.js module to convert EPUB files to plain text chapters.

Usage

Processing content

To get the chapters as strings:

var epubToText = new EPUBToText;
epubToText.extract('epub_file.epub', (err, txt, n) => {
  // txt is the plain text version of chapter number n
})

If you need to know how many chapters are in the EPUB file, you can do:

var epubToText = new EPUBToText;
epubToText.extract('epub_file.epub', (err, txt, n) => {
  // txt is the plain text version of chapter number n
}, (err, N) => {
  // N is the number of chapters
})

Writing to disk

To write the chapters to disk:

var epubToText = new EPUBToText;
epubToText.extractTo('epub_file.epub', 'full_path_to_dest_folder', (err) => {
  // files are in folder, name according to the following convention:
  //   sequence number + original epub file name + .txt
})