
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
epub is a node.js module to parse EPUB electronic book files.
NB! Only ebooks in UTF-8 are currently supported!.
npm install epub
Or, if you want a pure-JS version (useful if used in a Node-Webkit app for example):
npm install epub --no-optional
import EPub from 'epub'
const epub = new EPub(pathToFile, imageWebRoot, chapterWebRoot)
Where
<img>
blocks) is going to be /images/IMG_ID/IMG_FILENAME, IMG_ID
can be used to fetch the image form the ebook with getImage
. Default: /images/
<a>
links) is going to be /chapters/CHAPTER_ID/CHAPTER_FILENAME, CHAPTER_ID
can be used to fetch the image form the ebook with getChapter
. Default: /links/
Before the contents of the ebook can be read, it must be opened (EPub
is an EventEmitter
).
epub.on('end', function() {
// epub is initialized now
console.log(epub.metadata.title)
epub.getChapter('chapter_id', (err, text) => {})
})
epub.parse()
Property of the epub object that holds several metadata fields about the book.
epub.metadata
Available fields:
flow is a property of the epub object and holds the actual list of chapters (TOC is just an indication and can link to a # url inside a chapter file)
epub.flow.forEach(chapter => {
console.log(chapter.id)
})
Chapter id
is needed to load the chapters getChapter
toc is a property of the epub object and indicates a list of titles/urls for the TOC. Actual chapter and it's ID needs to be detected with the href
property
Load chapter text from the ebook.
epub.getChapter('chapter1', (error, text) => {})
Load raw chapter text from the ebook.
Load image (as a Buffer value) from the ebook.
epub.getImage('image1', (error, img, mimeType) => {})
Load any file (as a Buffer value) from the ebook.
epub.getFile('css1', (error, data, mimeType) => {})
FAQs
Parse ePub electronic book files with Node.JS
The npm package epub receives a total of 2,242 weekly downloads. As such, epub popularity was classified as popular.
We found that epub demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.