compress-epub

1.1.0 • Public • Published

compress-epub

compress-epub is an npm package designed to compress .epub files up to 91% of their original size by compressing the images included in the epubs. It allows specifying a compression level from 1 to 10.

Installation

You can install the package via npm:

npm install compress-epub

Import

const compressEpub = require('compress-epub');
import compressEpub from 'compress-epub';

Examples

// Return a buffer with the new epub compressed
const buffer = await compressEpub('stephenking.epub');

// Save the new file in the indicated path
await compressEpub('stephenking.epub', {output: './newfile.epub'});

// Example with all options
await compressEpub('stephenking.epub', {
	quality: 10, /* 1 to 10 */
	output: './newfile.epub',
	outputDir: '/tmp/out', // where epub are decompressed
	debug: false,
});

Try online

You can try it in this page: https://compressepub.com/

Package Sidebar

Install

npm i compress-epub

Weekly Downloads

1

Version

1.1.0

License

ISC

Unpacked Size

5.18 kB

Total Files

3

Last publish

Collaborators

  • luisperis.com