https://github.com/tkosminov/epub-parser
Simple epub parser
https://github.com/tkosminov/epub-parser
epub parser
Last synced: 10 months ago
JSON representation
Simple epub parser
- Host: GitHub
- URL: https://github.com/tkosminov/epub-parser
- Owner: tkosminov
- License: mit
- Created: 2022-04-17T16:39:46.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-07-12T05:16:51.000Z (over 1 year ago)
- Last Synced: 2025-03-24T12:04:21.767Z (11 months ago)
- Topics: epub, parser
- Language: TypeScript
- Homepage:
- Size: 4.79 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# simple-epub-parser
## 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
```bash
npm i epub-parser-simple
```
## Usage
```ts
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', () => {});
```