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

node-isbn

v1.6.1

Published

Find books by ISBN

Downloads

870

Readme

node-isbn

A simple node.js module that resolves books by ISBN using multiple services:

Installation

$ npm install node-isbn

Supports Node.js versions 6.x and greater.

Examples

Using a callback

var isbn = require('node-isbn');

isbn.resolve('0735619670', function (err, book) {
    if (err) {
        console.log('Book not found', err);
    } else {
        console.log('Book found %j', book);
    }
});

Setting a timeout

var isbn = require('node-isbn');

isbn.resolve('0735619670', { timeout: 15000 }, function (err, book) {
    if (err) {
        console.log('Book not found', err);
    } else {
        console.log('Book found %j', book);
    }
});

Using a promise

var isbn = require('node-isbn');

isbn.resolve('0735619670').then(function (book) {
    console.log('Book found %j', book);
}).catch(function (err) {
    console.log('Book not found', err);
});

Response

Response follows the same schema, but some fields could depend on the service that was used to find the book. In general, Google Books API returns more information.

{
    "title": "Code Complete",
    "authors": [
        "Steve McConnell"
    ],
    "publisher": "O'Reilly Media, Inc.",
    "publishedDate": "2004",
    "description": "Features the best practices in the art and...",
    "industryIdentifiers": [
        {
            "type": "OTHER",
            "identifier": "UCSC:32106018687688"
        }
    ],
    "readingModes": {
        "text": false,
        "image": false
    },
    "pageCount": 914,
    "printType": "BOOK",
    "categories": [
        "Computers"
    ],
    "averageRating": 4,
    "ratingsCount": 123,
    "contentVersion": "preview-1.0.0",
    "imageLinks": {
        "smallThumbnail": "http://books.google.com/books/content?id=QnghAQAAIAAJ&printsec=frontcover&img=1&zoom=5&source=gbs_api",
        "thumbnail": "http://books.google.com/books/content?id=QnghAQAAIAAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api"
    },
    "language": "en",
    "previewLink": "http://books.google.es/books?id=QnghAQAAIAAJ&dq=isbn:0735619670&hl=&cd=1&source=gbs_api",
    "infoLink": "http://books.google.es/books?id=QnghAQAAIAAJ&dq=isbn:0735619670&hl=&source=gbs_api",
    "canonicalVolumeLink": "http://books.google.es/books/about/Code_Complete.html?hl=&id=QnghAQAAIAAJ"
}

Setting backend providers

You can optionally specify the providers that you want to use, in the order you need them to be invoked.

// This request will search first in the Open Library API and then in the Google Books API
isbn.provider(['openlibrary', 'google'])
    .resolve('0735619670')
    .then(function (book) {
        console.log('Book found %j', book);
    }).catch(function (err) {
        console.log('Book not found', err);
    });
// This request will search ONLY in the Google Books API
isbn.provider(['google'])
    .resolve('0735619670')
    .then(function (book) {
        console.log('Book found %j', book);
    }).catch(function (err) {
        console.log('Book not found', err);
    });

If you do not like using strings to specify the providers, you could grab the providers from isbn.PROVIDER_NAMES constant that the library provides!

// This request will search ONLY in the Google Books API
isbn.provider([isbn.PROVIDER_NAMES.GOOGLE])
    .resolve('0735619670')
    .then(function (book) {
        console.log('Book found %j', book);
    }).catch(function (err) {
        console.log('Book not found', err);
    });

License

AGPL v3.0 LICENSE http://www.gnu.org/licenses/agpl-3.0.html

See also Google Books API Terms of Service, Open Library Licensing, WorldCat xISBN Terms of Service, ISBNdb Terms and Conditions.

Development

  • Ensure that you using Node 6 or greater.
  • Tests use mocha. Feel free to contribute.
$ npm test