Skip to content

sidhantpanda/xkcd-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xkcd-api

An API wrapper and CLI tool to fetch xkcd comics.

$ npx xkcd-api
$ 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(response);
  }
});

Get a particular comic

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

Get a random comic

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

CLI Features

Please make sure you've installed the package globally or are running it with npx.

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

justchen1369


Submit issues

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

About

An API wrapper to fetch xkcd comics

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •