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 🙏

© 2025 – Pkg Stats / Ryan Hefner

epubbd

v0.7.1

Published

Promise-based Node.js EPUB generator

Readme

epubbd

Promise-based Node.js EPUB 3.0 generator

const epubbd = require('epubbd');
const options = {
    title: 'My Book',
    css: './style.css',
    cover: 'https://i.picsum.photos/id/127/200/300.jpg',
    contents: [{
        title: 'Chapter 1',
        subTitle: 'The very first chapter',
        html: '<div><p>HTML that goes inside the BODY tag</p></div>'
    }]
}

(async() => {
  // create a buffer OR
  await epubbd.toBufferAsync(options);

  // output to a file
  await epubbd.toFileAsync(options, 'my-book.epub');
})();

Epubbd Methods

toFileAsync(options, outputLocation)

  • Creates an .epub file to the specified output location
  • Returns an empty Promise, else an EpubbdError

toBufferAsync(options)

  • Creates a buffer representation of the .epub file
  • Returns a Node Buffer, else an EpubbdError

Epubbd Options

title

The title of your EPUB file
Example: 'My Book of Nuts'

author

The author of your EPUB file. Setting multiple authors is not supported right now.
Example: 'Jane Smith'

publisher

The publisher of your EPUB file
Example: 'Squirrel Papers'

css

The stylesheet definition of your EPUB file. The <body/> tag of all XHTML pages are assigned a CSS class of epubbd-content you can use to target your HTML elements. If empty, this will default to a pre-defined CSS file that uses Lora Regular and Bold fonts.
Examples:

  • './main.css'
  • 'https://www.abc.com/css/styles.min.css'
  • 'body.epubbd-content{color:aqua}'

cover

The image file or data URL of your cover page. JPEG, PNG, GIF and SVG are the supported file types.
Examples:

  • './my-book-image.jpg'
  • 'https://www.abc.com/img/cover.jpg'
  • 'data:image/png;base64,..'

contents

An array of your book's content pages.
Example: [{ title, subTitle, html }]

contents[0].title

Page content title. This is the <h1> inside an <hgroup> tag at the beginning of your content page. It is also the same entry added to your book's Table of Contents.
Example: 'Chapter 1'

contents[0].subTitle

Page content sub title. This is the <h2> after the <h1> tag of the title at the beginning of your content page.
Example: 'The Very First Chapter'

contents[0].html

The HTML of your content page. The markup is sanitized before adding to the page to ensure XHTML compatibility. Embedded images with local paths must set the "src" attribute relative to where the currently running script is. Example: 'Hello World <br> Line break tag will be converted to <br/>'