xkcd-node
v1.0.0
Published
An API wrapper to fetch xkcd comics
Downloads
3
Maintainers
Readme
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 [email protected]