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

poly-ebook-server

v1.0.6

Published

Webserver for own ebook content: comics and epubs (cbr,cbz,cb7,epub, PDF)

Downloads

68

Readme

poly-ebook-server

WebApp (Client/Server) for own ebook content: comics, pdfs and epubs (cbr,cbz,cb7,epub,pdf,...).

This tool serves ebooks of given directories (and their sub directories). Depending on the bookExtensions option it shows comics, ebooks or something else. You can have poly-ebook-server display covers in a grid.

A cover must be generated as a jpg image file at the same directory. The name must be derived from the ebook file name by changing its suffix (book “abc.cbr” -> thumb file “abc.jpg”).

In the browser: all books are displayed in a thumb view. This view is optimized for a large number of books (Polymer iron-list). With help of a simple text input one can filter the list of the books. One can download a book, can send it (as link or attachment), or delete it (move to a predefined trash folder). An epub can be read online (in the browser).

Technology: Server based on node.js, client based on Google Polymer.

screen3

screen4

Preamble

I use this tool to get an overview of my ebooks. With my iPad and Android tablet I can grabble my hole collection. An ebook can be downloaded to the tablet by a simple click. In a later version I will integrate a comic online view, an internet search (to fetch book detail information), a toggle view (grouping books) and so on. Feel free to give me feedback!

Second reason for coding this is learning Google Polymer #UseThePlatform.

Getting started

ebook-cover-generator

This tool doesn't generate thumbs of your ebooks. If you want to do this, you can use ebook-cover-generator. On Mac OS X I recommend this tool: cover-generator-by-quicklook.

Installation

Create an empty folder. Open your shell (console) and navigate to this folder. Enter:

npm i poly-ebook-server

A directory named node_modules is created with some sub folders. Navigate to node_modules/poly-ebook-server:

cd node_modules/poly-ebook-server

Edit node start file (dev.js or prod.js) and adapt the configuration:

open dev.js

Start app with:

node dev.js

In case of an error have a look at clientRoot: __dirname + '/../client(/build/bundled)' and the baseDir:....

Usage (script)

var server = require('poly-ebook-server');
server.start(options<Object>);

Examples

Example with 3 start directories

This is an example for three different ebook types. In the json structure we have three sections (see below). Each section will be rendered as a tab in the browser. Each section has a start directory. All files in this directory and it's sub directories which fits to the file extension(s), will be displayed below the corresponding tab. If for a file a jpg exist, this will be display in the selected dimension (thumbsDims and dimIndex). The user has the possibility to change the thumb size at runtime.

In case of an error have a look at clientRoot: __dirname + '/../client'.

(function () {
  "use strict";

  var server = require('./index-js');
  var options = {
    title: "Ebooks",
    clientRoot: __dirname + '/client',
    port: 8081,
    sectionIndex: 0,
    sections: [
      {
        label: "Epub",
        bookExtensions: ['.epub'],
        baseDir: "/Users/marc/ebooks/Romane/alphabet",
        thumbsDims: [
          {width: 105, height: 150},
          {width: 210, height: 300},
          {width: 315, height: 450},
          {width: 420, height: 600}
        ],
        dimIndex: 1,
        initialFilter: 'krimi -kill',
        epubReader: true, // activates online epub reader
        trashDir: '/Users/marc/ebooks/trash', // if trashDir is defined, a delete button will be displayed.
        copyDir : '/Volumes/KOBOeReader', // tested with Kobo Aura H2O. Reader must be connected via USB.
        sendOptions: {
          sendattachment: {
            title: 'Send book',
            transport : 'smtps://[email protected]:[email protected]', // see https://www.npmjs.com/package/nodemailer
            from: '[email protected]',    // sender address
            to: '[email protected]',      // list of receivers
            subject: 'poly ebook server' // Subject line
          },
          sendlink: {
            title: '@getpocket',
            transport : 'smtps://[email protected]:[email protected]',
            from: '[email protected]',   // sender address
            to: '[email protected]', // list of receivers
            subject: 'filename'      // Subject line
          }
        } // null -> send buttons are hidden
      },
      {
        label: "Comic",
        bookExtensions: [".cbz", ".cbr"],
        baseDir: "/Volumes/2TB/jdownload/_comics",
        thumbsDims: [
          {width: 83, height: 150},
          {width: 196, height: 300},
          {width: 329, height: 450},
          {width: 392, height: 600}
        ],
        dimIndex: 1,
        initialFilter: "bill"
      },
      {
        label: "Magazine",
        bookExtensions: ['.pdf'],
        baseDir: "/Volumes/2TB/jdownload/_magazine",
        thumbsDims: [
          {width: 105, height: 150},
          {width: 210, height: 300},
          {width: 315, height: 450},
          {width: 420, height: 600}
        ],
        dimIndex: 1,
        initialFilter: ''
      }
    ]
  };
  server.start(options);

})();