{"id":43920208,"url":"https://github.com/likecoin/epub.ts","last_synced_at":"2026-04-02T15:37:36.737Z","repository":{"id":336915294,"uuid":"1151336927","full_name":"likecoin/epub.ts","owner":"likecoin","description":"A TypeScript fork of epubjs — parse and render EPUB documents in the browser.","archived":false,"fork":false,"pushed_at":"2026-02-26T15:54:38.000Z","size":2353,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-02-26T23:07:20.132Z","etag":null,"topics":["epub","epub-reader","epub3","epubjs","npm","typescript"],"latest_commit_sha":null,"homepage":"https://likecoin.github.io/epub.ts/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/likecoin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-02-06T10:41:07.000Z","updated_at":"2026-02-26T15:56:46.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/likecoin/epub.ts","commit_stats":null,"previous_names":["likecoin/epub.ts"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/likecoin/epub.ts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/likecoin%2Fepub.ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/likecoin%2Fepub.ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/likecoin%2Fepub.ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/likecoin%2Fepub.ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/likecoin","download_url":"https://codeload.github.com/likecoin/epub.ts/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/likecoin%2Fepub.ts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30054071,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T17:46:22.538Z","status":"ssl_error","status_checked_at":"2026-03-03T17:46:22.036Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["epub","epub-reader","epub3","epubjs","npm","typescript"],"created_at":"2026-02-06T22:09:19.973Z","updated_at":"2026-04-02T15:37:36.725Z","avatar_url":"https://github.com/likecoin.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# epub.ts (`@likecoin/epub-ts`)\n\n[![CI](https://github.com/likecoin/epub.ts/actions/workflows/ci.yml/badge.svg)](https://github.com/likecoin/epub.ts/actions/workflows/ci.yml)\n[![npm](https://img.shields.io/npm/v/%40likecoin%2Fepub-ts)](https://www.npmjs.com/package/@likecoin/epub-ts)\n[![License](https://img.shields.io/npm/l/%40likecoin%2Fepub-ts)](./LICENSE)\n\n**Drop-in replacement for [epubjs](https://github.com/futurepress/epub.js)** — same API, fully typed, 1 runtime dependency, actively maintained.\n\nA complete TypeScript rewrite of epubjs v0.3.93 with strict mode, modern tooling, and ongoing bug fixes — without breaking your existing code.\n\n## What you get\n\n- **Same API, zero migration cost** — change one import line and everything works\n- **Full TypeScript strict mode** — generated `.d.ts` from source, so autocomplete matches runtime\n- **1 runtime dependency** (`jszip`) — smaller bundle, simpler supply chain\n- **970+ tests** across 40 files — Vitest with robust coverage\n- **Vite build** — ESM, CJS, and UMD outputs out of the box\n- **Node.js support** — `@likecoin/epub-ts/node` parses EPUBs server-side with `linkedom`\n- **Active maintenance** — [20+ bug fixes](./CHANGELOG.md) and counting\n\n\u003e **Note**: Built at [3ook.com](https://3ook.com) and provided as-is. Forked from [epubjs](https://github.com/futurepress/epub.js) v0.3.93 by [Fred Chasen](https://github.com/fchasen) / [FuturePress](https://github.com/futurepress).\n\n## Get started\n\n### Install\n\n```bash\nnpm install @likecoin/epub-ts\n```\n\n### Migrate from epubjs\n\nChange one line — everything else stays the same:\n\n```diff\n- import ePub from \"epubjs\";\n+ import ePub from \"@likecoin/epub-ts\";\n```\n\n### Render an EPUB (browser)\n\n```typescript\nimport ePub from \"@likecoin/epub-ts\";\n\nconst book = ePub(\"/path/to/book.epub\");\nconst rendition = book.renderTo(\"viewer\", { width: 600, height: 400 });\nrendition.display();\n```\n\n### Load from file input\n\n```typescript\nimport ePub from \"@likecoin/epub-ts\";\n\nconst fileInput = document.querySelector('input[type=\"file\"]');\nfileInput.addEventListener(\"change\", async (event) =\u003e {\n\tconst file = event.target.files[0];\n\tconst data = await file.arrayBuffer();\n\tconst book = ePub(data);\n\tconst rendition = book.renderTo(\"viewer\", { width: 600, height: 400 });\n\trendition.display();\n});\n```\n\n### Parse on Node.js (no browser needed)\n\nExtract metadata, table of contents, and chapter HTML server-side. Requires [`linkedom`](https://github.com/WebReflection/linkedom):\n\n```bash\nnpm install linkedom\n```\n\n```typescript\nimport { Book } from \"@likecoin/epub-ts/node\";\nimport { readFileSync } from \"node:fs\";\n\nconst data = readFileSync(\"book.epub\");\nconst arrayBuffer = data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);\nconst book = new Book(arrayBuffer);\nawait book.opened;\n\nconsole.log(book.packaging.metadata.title);\nconsole.log(book.navigation.toc.map(item =\u003e item.label));\n\nconst section = book.spine.first();\nconst html = await section.render(book.archive.request.bind(book.archive));\n```\n\n## Named exports\n\n```js\nimport {\n\tBook, EpubCFI, Rendition, Contents, Layout,\n\tSection, Spine, Locations, Navigation, PageList,\n\tResources, Packaging, Archive, Store,\n\tAnnotations, Themes, Mapping,\n} from \"@likecoin/epub-ts\";\n```\n\n## API reference\n\nFull documentation: [likecoin.github.io/epub.ts](https://likecoin.github.io/epub.ts/)\n\n| Class | What it does |\n|-------|-------------|\n| `Book` | Load, parse, and manipulate an EPUB |\n| `Rendition` | Render a book into a DOM element |\n| `Contents` | Manage content inside an iframe |\n| `EpubCFI` | Parse EPUB Canonical Fragment Identifiers |\n| `Locations` | Generate and query reading positions |\n| `Navigation` | Table of contents and landmarks |\n| `Annotations` | Highlights, underlines, and marks |\n\n## Supported environments\n\n| Environment | Import | Notes |\n|-------------|--------|-------|\n| Modern browsers | `@likecoin/epub-ts` | Chrome, Firefox, Safari, Edge |\n| Vite / webpack | `@likecoin/epub-ts` | ESM or CJS |\n| Node.js 18+ | `@likecoin/epub-ts/node` | Parsing only (no rendering); requires `linkedom` peer dep |\n\n## Development\n\n```bash\ngit clone https://github.com/likecoin/epub.ts.git\ncd epub.ts\nnpm install\n```\n\n| Script | Description |\n|--------|-------------|\n| `npm run build` | Vite library build → `dist/` |\n| `npm test` | Run tests (Vitest) |\n| `npm run test:watch` | Run tests in watch mode |\n| `npm run typecheck` | `tsc --noEmit` |\n| `npm run lint` | ESLint |\n| `npm run lint:fix` | ESLint with auto-fix |\n| `npm run docs` | Generate API docs (HTML + Markdown) |\n\nRequires Node.js 18+ and npm 9+.\n\n## Contributing\n\nSee [PROJECT_STATUS.md](./PROJECT_STATUS.md) for current status and what to work on.\n\nFor AI agents contributing to this project, see [AGENTS.md](./AGENTS.md).\n\n## License\n\n[BSD-2-Clause](./LICENSE) (same as epubjs)\n\n## Acknowledgments\n\n- [epubjs](https://github.com/futurepress/epub.js) by [Fred Chasen](https://github.com/fchasen) / [FuturePress](https://github.com/futurepress) — the original library this is forked from\n- [jszip](https://github.com/Stuk/jszip) — ZIP file handling\n\n## Built by [3ook.com](https://3ook.com)\n\n3ook is a Web3 eBook platform where authors publish EPUB ebooks and readers collect them as digital assets.\n\n## Related projects\n\n- [epubjs](https://github.com/futurepress/epub.js) — Original EPUB reader library\n- [epubcheck-ts](https://github.com/likecoin/epubcheck-ts) — TypeScript EPUB validator (also by 3ook.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flikecoin%2Fepub.ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flikecoin%2Fepub.ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flikecoin%2Fepub.ts/lists"}