xkcd-api

1.2.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

Contributors

Štefan Jarina


Submit issues

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.2.0
    20
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.2.0
    20
  • 1.1.1
    0
  • 1.0.1
    7
  • 1.0.0
    0

Package Sidebar

Install

npm i xkcd-api

Weekly Downloads

27

Version

1.2.0

License

MIT

Unpacked Size

6.51 kB

Total Files

5

Last publish

Collaborators

  • sidhantpanda