Skip to content

Latest commit

 

History

History
34 lines (22 loc) · 1.1 KB

README.md

File metadata and controls

34 lines (22 loc) · 1.1 KB

simple-epub-parser

NPM Version Package License NPM Downloads

Description

The package exports a simple parser function which use epub file as input and output JavaScript object.

As it is written in TypeScript, types are already included in the package.

Installation

npm i epub-parser-simple

Usage

import fs from 'fs';

import { parseEpub } from 'epub-parser-simple'

const file_path = `${__dirname}/${file_name}.epub`;
const buffer = fs.readFileSync(file_path);

const parsed_book = await parseEpub(buffer)

fs.writeFile(`${__dirname}/${file_name}.json`, JSON.stringify(parsed_book, null, 2), 'utf8', () => {});