npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@likecoin/epub-ts

v0.4.6

Published

TypeScript EPUB parser and renderer, forked from epubjs

Readme

epub.ts (@likecoin/epub-ts)

A TypeScript fork of epubjs v0.3.93 by Fred Chasen / FuturePress — parse and render EPUB documents in the browser.

CI npm License

Note: This library is primarily developed for internal use at 3ook.com and is provided as-is. It was mainly built with AI-assisted development. For the original library, see epubjs.

Features

  • Drop-in replacement for epubjs v0.3.93 — same API, just change the import
  • TypeScript first — full strict mode, typed emitter, generated .d.ts declarations
  • Modern build — Vite library build, ESM + CJS output
  • Fewer dependencies — only 1 runtime dependency (jszip); removed core-js, lodash, path-webpack, event-emitter, localforage, @xmldom/xmldom
  • Named exports — import individual classes like Book, EpubCFI, Rendition, etc.

Installation

npm install @likecoin/epub-ts

Quick Start

ES Modules (recommended)

import ePub from "@likecoin/epub-ts";

const book = ePub("/path/to/book.epub");
const rendition = book.renderTo("viewer", { width: 600, height: 400 });
rendition.display();

Browser (from ArrayBuffer)

import ePub from "@likecoin/epub-ts";

const fileInput = document.querySelector('input[type="file"]');
fileInput.addEventListener("change", async (event) => {
	const file = event.target.files[0];
	const data = await file.arrayBuffer();
	const book = ePub(data);
	const rendition = book.renderTo("viewer", { width: 600, height: 400 });
	rendition.display();
});

Node.js (parsing only)

Parse EPUB metadata, spine, navigation, and section content without a browser. Requires linkedom as a peer dependency.

npm install linkedom
import { Book } from "@likecoin/epub-ts/node";
import { readFileSync } from "node:fs";

const data = readFileSync("book.epub");
const arrayBuffer = data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
const book = new Book(arrayBuffer);
await book.opened;

console.log(book.packaging.metadata.title);
console.log(book.navigation.toc.map(item => item.label));

const section = book.spine.first();
const html = await section.render(book.archive.request.bind(book.archive));

Migration from epubjs

Drop-in replacement. Change your import:

- import ePub from "epubjs";
+ import ePub from "@likecoin/epub-ts";

All APIs remain the same.

Named Exports

import {
	Book, EpubCFI, Rendition, Contents, Layout,
	Section, Spine, Locations, Navigation, PageList,
	Resources, Packaging, Archive, Store,
	Annotations, Themes, Mapping,
} from "@likecoin/epub-ts";

API

See the full API documentation for details on all classes, interfaces, and methods.

Key classes:

| Class | Description | |-------|-------------| | Book | Main EPUB representation — loading, parsing, manipulation | | Rendition | Renders a book to a DOM element | | Contents | Manages content within an iframe | | EpubCFI | EPUB Canonical Fragment Identifier parser | | Locations | Generates and manages reading locations | | Navigation | Table of contents and landmarks | | Annotations | Highlights, underlines, and marks |

Comparison with epubjs

| Aspect | epub.ts | epubjs | |--------|---------|--------| | Language | TypeScript (strict mode) | JavaScript | | Build | Vite | webpack + Babel | | Tests | Vitest | Karma + Mocha | | Type definitions | Generated from source | Hand-written .d.ts | | Dependencies | 1 (jszip) | 7+ (core-js, lodash, event-emitter, etc.) | | API compatibility | 100% (drop-in replacement) | — | | Bundle format | ESM + CJS + UMD | UMD | | Maintenance | Active | Inactive since 2022 |

Supported Environments

| Environment | Import | Notes | |-------------|--------|-------| | Modern browsers | @likecoin/epub-ts | Chrome, Firefox, Safari, Edge | | Vite / webpack | @likecoin/epub-ts | ESM or CJS | | Node.js 18+ | @likecoin/epub-ts/node | Parsing only (no rendering); requires linkedom peer dep |

What's Changed from epubjs

  • Build: webpack + Babel → Vite
  • Tests: Karma + Mocha → Vitest
  • Source: JavaScript → TypeScript (full strict mode)
  • Removed dependencies: core-js, lodash, path-webpack, localforage, @xmldom/xmldom
  • Replaced event-emitter with inline typed emitter
  • Replaced localforage with native IndexedDB wrapper
  • Replaced @xmldom/xmldom with native DOMParser/XMLSerializer
  • Added Node.js parsing-only entry point (@likecoin/epub-ts/node) with linkedom
  • Dropped IE8–IE11 support

Development

Prerequisites

  • Node.js 18+
  • npm 9+

Setup

git clone https://github.com/likecoin/epub.ts.git
cd epub.ts
npm install

Scripts

| Script | Description | |--------|-------------| | npm run build | Vite library build → dist/ | | npm test | Run tests (Vitest) | | npm run test:watch | Run tests in watch mode | | npm run typecheck | TypeScript type checking (tsc --noEmit) | | npm run lint | ESLint | | npm run lint:fix | ESLint with auto-fix | | npm run docs | Generate API docs (HTML + Markdown) |

Contributing

See PROJECT_STATUS.md for current conversion progress and what to work on.

For AI agents contributing to this project, see AGENTS.md.

License

BSD-2-Clause (same as epubjs)

Acknowledgments

Built by 3ook.com

This project is built and maintained by the 3ook.com team. 3ook is a Web3 eBook platform where authors can publish EPUB ebooks and readers can collect them as digital assets.

Related Projects

  • epubjs — Original EPUB reader library
  • epubcheck-ts — TypeScript EPUB validator (also by 3ook.com)