xkcd-node

1.0.0 • Public • Published

xkcd-api

An API wrapper to fetch xkcd comics. Includes CLI too!

npm install xkcd-api
var xkcd = require('xkcd-api');

APIs available

CLI equivalent

Get the latest comic

xkcd.latest(function(error, response) {
  if (error) {
    console.error(error);
  } else {
    console.log(reponse);
  }
});

Get a particular comic

xkcd.get('comic-id', function(error, response) {
  if (error) {
    console.error(error);
  } else {
    console.log(reponse);
  }
});

Get a random comic

xkcd.random(function(error, response) {
  if (error) {
    console.error(error);
  } else {
    console.log(reponse);
  }
});

Get the latest comic (CLI)

xkcd-api
xkcd-api -l
xkcd-api --latest

Get a particular comic (CLI)

xkcd-api -n 1714
xkcd-api --number 1714

Get a random comic (CLI)

xkcd-api -r
xkcd-api --random

Submit issues

You can raise an issue in this repo or mail me at sidhant@hashexclude.com

Package Sidebar

Install

npm i xkcd-node

Weekly Downloads

1

Version

1.0.0

License

none

Last publish

Collaborators

  • r1cebank