{"_id":"@asteasolutions/epub-reader","_rev":"7-3ffb8fe9d88a868b89f42143854cb936","name":"@asteasolutions/epub-reader","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.0":{"name":"@asteasolutions/epub-reader","version":"1.0.0","license":"MIT","_id":"@asteasolutions/epub-reader@1.0.0","maintainers":[{"name":"apazvantov","email":"apazvantov@gmail.com"},{"name":"georgyangelov","email":"georgyangelov@gmail.com"},{"name":"pockata.kt","email":"pockata.kt@gmail.com"},{"name":"rganchev","email":"rganchev@asteasolutions.com"},{"name":"sachanski","email":"ivaylo.sachanski@asteasolutions.com"}],"dist":{"shasum":"fb51a7cd748e37e928f14188607c93af9631fb51","tarball":"https://registry.npmjs.org/@asteasolutions/epub-reader/-/epub-reader-1.0.0.tgz","fileCount":98,"integrity":"sha512-w0X1MkFERgwWPs04tFBteT5qzjeYJP7FMG3JP9QcS4UAbDOPHdwgLYIyp+IM8eC5XR0+w8ox3cB5QQsvdpOOoA==","signatures":[{"sig":"MEUCIBqSTmeFmBrP4YAbThgGw0rdO3cyUMk6/+V2zi6kFucKAiEArwxL0XNMBq+2X5lhwMUVmF+thdpinrk04WIW06a5OUQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":117497},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"7f84d26c1919fb7cb3d6814c6f5856b0c11c6ec1","scripts":{"lint":"eslint lib --report-unused-disable-directives --max-warnings 0 && prettier ./lib --check && tsc --build","build":"tsc","watch":"tsc --watch","prepare":"tsc","prepublish":"tsc"},"_npmUser":{"name":"sachanski","email":"ivaylo.sachanski@asteasolutions.com"},"repository":{"url":"ssh://git@gitlab.asteasolutions.net:822/reader/reader-core.git","type":"git"},"_npmVersion":"11.0.0","description":"An EPUB reader library","directories":{},"_nodeVersion":"22.9.0","dependencies":{"rxjs":"^7.8.2","lodash":"^4.17.21","@zip.js/zip.js":"^2.7.60","fast-xml-parser":"^5.2.1"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.12.0","globals":"^15.11.0","prettier":"^3.3.3","@eslint/js":"^9.12.0","typescript":"^5.5.4","@types/node":"^22.7.5","@types/lodash":"^4.17.10","typescript-eslint":"^8.8.1"},"_npmOperationalInternal":{"tmp":"tmp/epub-reader_1.0.0_1745501040702_0.6710608456019171","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@asteasolutions/epub-reader","version":"1.0.1","license":"MIT","_id":"@asteasolutions/epub-reader@1.0.1","maintainers":[{"name":"apazvantov","email":"apazvantov@gmail.com"},{"name":"georgyangelov","email":"georgyangelov@gmail.com"},{"name":"pockata.kt","email":"pockata.kt@gmail.com"},{"name":"rganchev","email":"rganchev@asteasolutions.com"},{"name":"sachanski","email":"ivaylo.sachanski@asteasolutions.com"}],"dist":{"shasum":"8a20c5ff2987e4d5c5a23de7a32b47f7ae554d6f","tarball":"https://registry.npmjs.org/@asteasolutions/epub-reader/-/epub-reader-1.0.1.tgz","fileCount":98,"integrity":"sha512-i+Rmroa1tE3ySAsk6oRt1r70eulUIWuSQE/L3PuSXhkc5B/jy2dh2DCAwuYv4Pf0bEcBrzNbtzB4msGlwPTlmQ==","signatures":[{"sig":"MEUCIQCfRv0/b/eFdbNOT8nB+KPRy3k+c8gpGGIYoRK0R8K8iwIgGy5NnLs62nuzc4Tjum+z62kreubUO0Xx+NxlhCcap1E=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":117802},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"7bbcd32f612ac4d884686de94252ba8efb2e6913","scripts":{"lint":"eslint lib --report-unused-disable-directives --max-warnings 0 && prettier ./lib --check && tsc --build","build":"tsc","watch":"tsc --watch","prepare":"tsc","prepublish":"tsc"},"_npmUser":{"name":"sachanski","email":"ivaylo.sachanski@asteasolutions.com"},"repository":{"url":"ssh://git@gitlab.asteasolutions.net:822/reader/reader-core.git","type":"git"},"_npmVersion":"11.5.1","description":"An EPUB reader library","directories":{},"_nodeVersion":"24.6.0","dependencies":{"rxjs":"^7.8.2","lodash":"^4.17.21","@zip.js/zip.js":"^2.7.60","fast-xml-parser":"^5.2.1"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.12.0","globals":"^15.11.0","prettier":"^3.3.3","@eslint/js":"^9.12.0","typescript":"^5.5.4","@types/node":"^22.7.5","@types/lodash":"^4.17.10","typescript-eslint":"^8.8.1"},"_npmOperationalInternal":{"tmp":"tmp/epub-reader_1.0.1_1771850285136_0.40847455847099146","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@asteasolutions/epub-reader","version":"1.0.2","license":"MIT","_id":"@asteasolutions/epub-reader@1.0.2","maintainers":[{"name":"apazvantov","email":"apazvantov@gmail.com"},{"name":"georgyangelov","email":"georgyangelov@gmail.com"},{"name":"pockata.kt","email":"pockata.kt@gmail.com"},{"name":"rganchev","email":"rganchev@asteasolutions.com"},{"name":"sachanski","email":"ivaylo.sachanski@asteasolutions.com"}],"dist":{"shasum":"40454df700fea43beadc295d7db1b86ad9030b0e","tarball":"https://registry.npmjs.org/@asteasolutions/epub-reader/-/epub-reader-1.0.2.tgz","fileCount":98,"integrity":"sha512-WO/r0maSlJ5MbpJfuRxXUFCWKBrXrqCR6vQbtDvR8WKZEAmAMCFlav2+JsPgthyYCMeAZ0iZzdN9uqv05UTEGQ==","signatures":[{"sig":"MEUCIQD7F1I8SzJ3yWmczxDqcx1zp5J+m6XwhtlJ39kzPHVW7wIgavzH7vAxeE0mSqZV5KBojbhhI+mPqTb/cQAuyDc69do=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":121597},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"8aea8e6774d41f9c6ade3d2f71aa78a87f8409e7","scripts":{"lint":"eslint lib --report-unused-disable-directives --max-warnings 0 && prettier ./lib --check && tsc --build","build":"tsc","watch":"tsc --watch","prepare":"tsc","prepublish":"tsc"},"_npmUser":{"name":"sachanski","email":"ivaylo.sachanski@asteasolutions.com"},"repository":{"url":"ssh://git@gitlab.asteasolutions.net:822/reader/reader-core.git","type":"git"},"_npmVersion":"11.5.1","description":"An EPUB reader library","directories":{},"_nodeVersion":"24.6.0","dependencies":{"rxjs":"^7.8.2","lodash":"^4.17.21","@zip.js/zip.js":"^2.7.60","fast-xml-parser":"^5.2.1"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.12.0","globals":"^15.11.0","prettier":"^3.3.3","@eslint/js":"^9.12.0","typescript":"^5.5.4","@types/node":"^22.7.5","@types/lodash":"^4.17.10","typescript-eslint":"^8.8.1"},"_npmOperationalInternal":{"tmp":"tmp/epub-reader_1.0.2_1771923600586_0.1290002605513254","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@asteasolutions/epub-reader","version":"1.0.3","license":"MIT","_id":"@asteasolutions/epub-reader@1.0.3","maintainers":[{"name":"apazvantov","email":"apazvantov@gmail.com"},{"name":"georgyangelov","email":"georgyangelov@gmail.com"},{"name":"pockata.kt","email":"pockata.kt@gmail.com"},{"name":"rganchev","email":"rganchev@asteasolutions.com"},{"name":"sachanski","email":"ivaylo.sachanski@asteasolutions.com"}],"dist":{"shasum":"9864cb1603d8e6e3b67b1ebc2fc58e0a3f72913a","tarball":"https://registry.npmjs.org/@asteasolutions/epub-reader/-/epub-reader-1.0.3.tgz","fileCount":98,"integrity":"sha512-J+05KUdYKviHwZOweYuj7SF/eJ90916TIJD81Su9v4tUjYcukkCtosiTqcvZ0SsPrNhMgmiTHKX5LVs3aeZKfw==","signatures":[{"sig":"MEYCIQCh0wJRrF3XVhgAz+8s7W2aLVj7FHlUQZqaYN9G9IeNxwIhANUi93wctwSgQTYYFMXC5gWa5L6irK3PqivwiTMBfU+A","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":122446},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"e0841d87e314b695afbc6e25470c537cb1a1599f","scripts":{"lint":"eslint lib --report-unused-disable-directives --max-warnings 0 && prettier ./lib --check && tsc --build","build":"tsc","watch":"tsc --watch","prepare":"tsc","prepublish":"tsc"},"_npmUser":{"name":"sachanski","email":"ivaylo.sachanski@asteasolutions.com"},"repository":{"url":"ssh://git@gitlab.asteasolutions.net:822/reader/reader-core.git","type":"git"},"_npmVersion":"11.5.1","description":"An EPUB reader library","directories":{},"_nodeVersion":"24.6.0","dependencies":{"rxjs":"^7.8.2","lodash":"^4.17.21","@zip.js/zip.js":"^2.7.60","fast-xml-parser":"^5.2.1"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.12.0","globals":"^15.11.0","prettier":"^3.3.3","@eslint/js":"^9.12.0","typescript":"^5.5.4","@types/node":"^22.7.5","@types/lodash":"^4.17.10","typescript-eslint":"^8.8.1"},"_npmOperationalInternal":{"tmp":"tmp/epub-reader_1.0.3_1771947199518_0.6838851464723072","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@asteasolutions/epub-reader","version":"1.0.4","license":"MIT","_id":"@asteasolutions/epub-reader@1.0.4","maintainers":[{"name":"apazvantov","email":"apazvantov@gmail.com"},{"name":"georgyangelov","email":"georgyangelov@gmail.com"},{"name":"pockata.kt","email":"pockata.kt@gmail.com"},{"name":"rganchev","email":"rganchev@asteasolutions.com"},{"name":"sachanski","email":"ivaylo.sachanski@asteasolutions.com"}],"dist":{"shasum":"89abf3b2e397dc3880832effdfa763d5ad2a7729","tarball":"https://registry.npmjs.org/@asteasolutions/epub-reader/-/epub-reader-1.0.4.tgz","fileCount":98,"integrity":"sha512-AL9hRMNlpH7CbEEj9KgH8bCiEvctqwgiaqw6LxpXbjdIVkaz2FTv1pGl2ahqk9VAbwy3xR4FW5iHycYqS5Q7/A==","signatures":[{"sig":"MEYCIQD83WMXSPofmRzF2I9VZU7dUa3SWIYNoUguz1/B7hiolgIhAOr2E9HcnJFAt6ts95t+/PBWEz2QGSXJio2tidfvlCyO","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":122461},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"4ed5da6813b89c3877ca5d30921d65e471a7b098","scripts":{"lint":"eslint lib --report-unused-disable-directives --max-warnings 0 && prettier ./lib --check && tsc --build","build":"tsc","watch":"tsc --watch","prepare":"tsc","prepublish":"tsc"},"_npmUser":{"name":"sachanski","email":"ivaylo.sachanski@asteasolutions.com"},"repository":{"url":"ssh://git@gitlab.asteasolutions.net:822/reader/reader-core.git","type":"git"},"_npmVersion":"11.5.1","description":"An EPUB reader library","directories":{},"_nodeVersion":"24.6.0","dependencies":{"rxjs":"^7.8.2","lodash-es":"^4.17.23","@zip.js/zip.js":"^2.7.60","fast-xml-parser":"^5.3.7"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^10.0.2","globals":"^15.11.0","prettier":"^3.3.3","@eslint/js":"^10.0.1","typescript":"^5.5.4","@types/node":"^22.7.5","@types/lodash-es":"^4.17.12","typescript-eslint":"^8.56.1"},"_npmOperationalInternal":{"tmp":"tmp/epub-reader_1.0.4_1771948765983_0.8751962649403566","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2025-04-24T13:24:00.587Z","modified":"2026-06-30T14:51:50.913Z","1.0.0":"2025-04-24T13:24:00.917Z","1.0.1":"2026-02-23T12:38:05.293Z","1.0.2":"2026-02-24T09:00:00.733Z","1.0.3":"2026-02-24T15:33:19.695Z","1.0.4":"2026-02-24T15:59:26.143Z"},"license":"MIT","repository":{"url":"ssh://git@gitlab.asteasolutions.net:822/reader/reader-core.git","type":"git"},"description":"An EPUB reader library","maintainers":[{"email":"apazvantov@gmail.com","name":"apazvantov"},{"email":"georgyangelov@gmail.com","name":"georgyangelov"},{"email":"rganchev@asteasolutions.com","name":"rganchev"},{"email":"zmarinov@asteasolutions.com","name":"zahari_marinov"},{"email":"ivaylo.sachanski@asteasolutions.com","name":"sachanski"}],"readme":"# EPub Reader\n\nA library that loads and renders ePub documents in the browser.\n\nIt provides support for:\n* [Media Overlays](https://www.w3.org/TR/epub/#sec-media-overlays) - if the ePub has smil files the library plays the narration and highlights the corresponding html element. The client can also obtain the current time of the audio book and the total duration.\n* [Navigation](https://www.w3.org/TR/epub-33/#sec-nav)\n  * For EPub 3.0 the manifest `<item properties=\"nav\" />` element is parsed and provided in the form of a Table of contents (page list is also included).\n  * Support for EPub 2.0 `<item media-type=\"application/x-dtbncx+xml\" />` is not yet implemented.\n* Cover image\n  * For EPub 3.0 a manfiest `<item properties=\"cover-image\" />` element is checked.\n  * For EPub 2.0 `<meta name=\"cover\" />` is not yet implemented.\n* Metadata\n  * Identifier (`<dc:identifier>`)\n  * Title (`<dc:title>`)\n  * Language (`<dc:language>`)\n  * Author (`<dc:creator>`)\n\n## Getting started\n\n### Installation\n\n```\nnpm i @asteasolutions/epub-reader\n```\n\n### Usage\n\nFirst you need an HTML element where the content will be rendered\n\n```html\n<div id=\"epub-reader\"></div>\n```\n\nThen you need to pass the epub document. The library provides two loaders which you can use depending on the source of the epub:\n* `ZipLoader` - use this when you have a Blob/File (e.g. selected by the user from the file system or downloaded from a url) or a url to an epub file. In the case of a url the epub is streamed instead of being downloaded in its entirety.\n* `AJAXUnpackedLoader` - use this when the epub is extracted and served statically from a url.\n\nYou can also use the `createLoader` function which will create a loader for you based on the parameters passed.\n```javascript\n// This expects the epub files to be statically served on the corresponding path appended to the url - e.g. https://example-epub-library.com/awesome-epub/META-INF/container.xml\ncreateLoader('https://example-epub-library.com/awesome-epub')\n\n// This will create a ZipLoader\ncreateLoader('https://example-epub-library.com/awesome-zipped-epub', { isZipURL: true })\n// same as this\ncreateLoader(file)\n```\n\nPutting it all together\n```typescript\nimport { createLoader, Book, Reader } from '@asteasolutions/reader-core'\n\nconst container = document.getElementById('epub-reader')\n\nconst loader = await createLoader(source: Blob | string)\nBook.open(loader).subscribe({\n  next: book => {\n    const reader = new Reader(container, book)\n\n    reader.loadContent().subscribe(() => {\n      // EPub is now rendered\n    })\n  }\n})\n```\n\n### Events\n\nOnce initialized you can listen to the following `Reader` events:\n| Property | Description |\n| -------- | ----------- |\n| `audioEvents.onPlaybackStateChanged` | Fired with a single argument `playing: boolean` |\n| `audioEvents.onAudioEnded` | Fired when an audio file reached its end |\n| `audioEvents.onPositionChanged` | Fired every 200 ms while a media overlay is playing. It is passed a single argument `currentTime: number`, indicating the current time (in seconds) within the audio file |\n| `events.pageChange` | Fired when the reader navigates to a new page |\n| `events.chapterChange` | Fired when a new chapter is loaded (new html from the epub is rendered) |\n| `events.textSelected` | Fired when the user selects something in the epub's html. Passed a `range: DOMRange` argument |\n| `mediaOverlayEvents.onGlobalPositionChanged` | Similar to the `audioEvents.onPositionChanged` but in the context of the entire book. Also the argument is in milliseconds |\n\n### API\n\n| Object | Property | Description |\n| ------ | -------- | ----------- |\n| **Reader** | `currentChapterIndex` | The index of the current chapter as defined in the epub's `<spine>` tag |\n| | `totalChapters` | The number of chapters in the epub |\n| | `currentPage` | The index of the current page within the chapter. <br><br> *Note*: Since only a paginated layout is currently supported, the page properties are referring to the currently dispalyed pages and not the page list of the navigation document. This means that resizing the container holding the epub will cause the pages to be recalculated. |\n| | `totalPages` | The number of pages within the chapter |\n| | `playing` | Whether or not a media overlay is being played |\n| | `togglePlayback()` | Turns the media overlay playback on/off |\n| | `goToHref(href: string).subscribe()` | Navigates to an anchor within the epub. For example passing the `href` property from a `TocEntry` |\n| | `previousChapter(goToEnd?: boolean)` | Navigates to the previous chapter. In case `true` is passed the epub will be navigated to the last page of the previous chapter, otherwise it will go to the beginning |\n| | `previousPage()` | Navigates to the previous page in the chapter. If the user is on the first page of a chapter the epub is navigated to the last page of the previous chapter |\n| | `nextPage()` | Navigates to the first page of the next chapter |\n| | `nextPage()` | Navigates to the next page in the chapter. If the user is on the last page it will navigate to the first page of the next chapter |\n| **Book** | `metadata` | The `Metadata` object for the epub |\n| | `nav` | The `Navigation` object for the epub |\n| | `cover` | The cover image url |\n| | `overlayMetadata` | The `OverlayMetadata` object for the epub. Contains the total duration of the epub and the durations for each smil file |\n| | `open(loader: BookLoader)` *static* | Creates the book object with the given loader |\n\n### Rendering\n\nCurrently on a paginated layout is supported.\n","readmeFilename":"README.md"}