1.2.0 • Published 5 years ago

xkcd-api v1.2.0

Weekly downloads
18
License
MIT
Repository
github
Last release
5 years ago

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

Contributors

Štefan Jarina


Submit issues

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