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

thegamesdb

v0.1.2

Published

TheGamesDB.net API wrapper

Downloads

9

Readme

TheGamesDB.js

Just a Javascript wrapper to TheGamesDB.net API. Original API documentation can be found here.

Introduction

Althought other libraries can query the API and parse XML responses, I found that resultant objects were too complex and not so normalized as I wished. So I've used reducer functions to create simpler objects and attributes, with parsed data (numbers and dates) and normalized lists, to be more serializable and JSON friendly.

Query functions return Javascript promises using promise based axios client library (browser and Node compatible).

Installation

npm install thegamesdb

Usage

// ES6
import thegamesdb from 'thegamesdb';

// ES5
var thegamesdb = require('thegamesdb');

thegamesdb.getGame({ id: 1 }).then(cb);
thegamesdb.getGamesList({ name: 'super mario' }).then(cb).catch(err);
...

API

thegamesdb.getGame({ id }): Object

thegamesdb.getGame({ id: 1})
{
  "id": 1,
  "title": "Halo: Combat Evolved",
  "platform": "PC",
  "releaseDate": "2001-12-15T00:00:00.000Z",
  "overview": "In Halo's twenty-sixth century setting, the player assumes the role of the Master Chief, a cybernetically enhanced super-soldier. The player is accompanied by Cortana, an artificial intelligence who occupies the Master Chief's neural interface. Players battle various aliens on foot and in vehicles as they attempt to uncover the secrets of the eponymous Halo, a ring-shaped artificial planet.",
  "ESRB": "T - Teen",
  "genres": [
    "Shooter"
  ],
  "players": "1",
  "youtube": "http://www.youtube.com/watch?v=dR3Hm8scbEw",
  "publisher": "Microsoft Game Studios",
  "developer": "Bungie",
  "rating": 6.8889,
  "similar": [
    {
      "id": 3996,
      "platformId": 14
    }
  ],
  "images": [
    {
      "type": "clearlogo",
      "url": "/clearlogo/1.png",
      "width": 400,
      "height": 200
    },
    {
      "type": "screenshot",
      "url": "/screenshots/1-1.jpg",
      "width": 800,
      "height": 600,
      "thumb": "/screenshots/thumb/1-1.jpg"
    },
    {
      "type": "screenshot",
      "url": "/screenshots/1-2.jpg",
      "width": 800,
      "height": 600,
      "thumb": "/screenshots/thumb/1-2.jpg"
    },
    ...
  ]
}

thegamesdb.getGamesList({ name [, platform ] }): Array

name param is mandatory. You can filter results by including exact platform name (not alias or ID).

thegamesdb.getGamesList({ name: 'super mario', platform: 'Super Nintendo (SNES)'})
[
  {
    "id": 3275,
    "title": "Super Mario All-Stars + Super Mario World",
    "releaseDate": "1994-01-16T00:00:00.000Z",
    "platform": "Super Nintendo (SNES)"
  },
  {
    "id": 136,
    "title": "Super Mario World",
    "releaseDate": "1990-12-21T00:00:00.000Z",
    "platform": "Super Nintendo (SNES)"
  },
  {
    "id": 21356,
    "title": "Mario no Super Picross",
    "releaseDate": "1995-10-14T00:00:00.000Z",
    "platform": "Super Nintendo (SNES)"
  },
  {
    "id": 41,
    "title": "Super Mario Kart",
    "releaseDate": "1992-10-01T00:00:00.000Z",
    "platform": "Super Nintendo (SNES)"
  },
  ...
]

thegamesdb.getGameArt({ id }): Array

thegamesdb.getGameArt({ id: 4 })
[
  {
    "type": "clearlogo",
    "url": "/clearlogo/4.png",
    "width": 400,
    "height": 148
  },
  {
    "type": "screenshot",
    "url": "/screenshots/4-1.jpg",
    "width": 1920,
    "height": 1080,
    "thumb": "/screenshots/thumb/4-1.jpg"
  },
  {
    "type": "banner",
    "url": "/graphical/4-g.jpg",
    "width": 760,
    "height": 140
  },
  {
    "type": "boxart",
    "url": "/boxart/original/back/4-1.jpg",
    "width": 1000,
    "height": 705,
    "side": "back"
  },
  ...
]

thegamesdb.getPlatform({ id }): Object

thegamesdb.getPlatform({ id: 1 })
{
  "id": 1,
  "name": "PC",
  "overview": "PC stands for Personal Computer. Mass-market consumer computers use highly standardized components and so are simple for an end user to assemble into a working system. A typical desktop computer consists of a computer case which holds the power supply, motherboard, hard disk and often an optical disc drive. External devices such as a computer monitor or visual display unit, keyboard, and a pointing device are usually found in a personal computer.",
  "developer": "IBM",
  "cpu": "x86 Based",
  "rating": 7,
  "images": [...]
}

thegamesdb.getPlatformsList(): Array

thegamesdb.getPlatformsList()
[
  {
    "id": 25,
    "name": "3DO",
    "alias": "3do"
  },
  {
    "id": 4944,
    "name": "Acorn Archimedes",
    "alias": "acorn-archimedes"
  },
  {
    "id": 4954,
    "name": "Acorn Electron",
    "alias": "acorn-electron"
  },
  {
    "id": 4911,
    "name": "Amiga",
    "alias": "amiga"
  },
  {
    "id": 4947,
    "name": "Amiga CD32",
    "alias": "amiga-cd32"
  },
  ...
]

thegamesdb.getPlatformGames({ id }): Array

thegamesdb.getPlatformGames({ id: 16 })
[
  {
    "id": 33,
    "title": "Jet Set Radio",
    "releaseDate": "2000-07-28T23:00:00.000Z"
  },
  {
    "id": 195,
    "title": "Marvel vs. Capcom: Clash of Super Heroes",
    "releaseDate": "1998-02-12T00:00:00.000Z"
  },
  {
    "id": 200,
    "title": "Ikaruga",
    "releaseDate": "2002-10-04T23:00:00.000Z"
  },
  {
    "id": 420,
    "title": "Dino Crisis",
    "releaseDate": "2000-12-14T00:00:00.000Z"
  },
  ...
]

License

MIT