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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ig3/calibre-web

v1.0.11

Published

A simple web server that serves epub books from local [Calibre](https://github.com/kovidgoyal/calibre) databases.

Downloads

12

Readme

calibre-web.js

A simple web server that serves epub books from local Calibre databases.

Installation

$ npm install -g @ig3/calibre-web

Operation

The package provides an executable: calibre-web

Run this to start the server:

$ calibre-web

It listens on port 9000.

Browse to http://localhost:9000.

It can be started by systemd. For example:

[Unit]
Description=Calibre Web server

[Service]
Type=simple
Restart=on-failure
WorkingDirectory=/tmp
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=calibre-web
ExecStart=calibre-web

[Install]
WantedBy=default.target

This can be installed as a system service or a per-user service. See the systemd documentation for details of setting up a service.

Configuration

Configuration may be stored in:

  • /etc/calibre-web.json
  • ~/.calibre-web.json
  • ~/.config/calibre-web.json

For example:

{
  "port": 1234,
  "databases": [
    "/usr/local/calibre",
    "/usr/share/calibre1",
    "/usr/share/calibre2"
  ],
  "excludeTags": [
    "hidden",
    "private"
  ],
  "showUntagged": true
}

port

The port the server should listen on.

databases

An array of paths to Calibre data directories, containing the metadata.db files.

defaultTags

An array of tags that will be selected by default (i.e. if no other tags are selected).

excludeTags

An array of tags for which books having any of these tags will be excluded from the book list.

explicitOnly

An array of tags that must be explicitly selected in order for books with those tags to be presented in the book list.

showUntagged

Set this to true if books without tags should be shown in the book list.

Features

This only serves epub files. Other content of the Calibre database will be ignored.

The home page shows the cover image, title and author of each book, sorted by timestamp which, I think, is the time the book was added to Calibre.

It can read multiple Calibre databases but they must be local: the Calibre database is read from a file path.

Server load is fairly light. Just a node process running an Express website. When not processing a request it should not consume CPU.

It uses epub.js in the browser to display the book. Once the book is downloaded, there is no more load on the server as it is browsed.

System Requirements

I have only run this on Debian Linux. Not tested on other distributions or operating systems.

Requires Node.js. I am running it on v18.13.0. Not tested on other versions.

When idle, with a couple of Calibre libraries totaling over 500 books, top reports under 50K physical memory consumed and 0% CPU. It occupies a little under 25MB disk space.

Dependencies

In addition to those listed in package.json, this depends on @ig3/epub.js and jszip.min.js, included in the public/js directory.

Motivation

I used Calibre-web for a while but when I was setting up a new laptop I wanted something easier to install. I had been running a modified version of Calibre-web and wanted an all JavaScript implementation.

Changes

1.0.8 - 20230410

Update dependencies.

1.0.9 - 20240506

  • Up and down arrow keys for prev and next chapter navigation
  • Handle sub-chapters in toc
  • Fix updateToc to handle href with fragment
  • Fix toc / navigation
  • Update dependencies

1.0.10 - 20240611

  • Revised tag filtering
  • Add ~/.config/calibre-web.json config file path

1.0.11 - WIP

  • Fix tag list handling
  • Update dependencies
  • Remove dev dependencies on tape and multi-tape
  • Refactor the server implementation
  • Add tests