An API wrapper and CLI tool to fetch xkcd comics.
$ npx xkcd-api
$ npm install xkcd-api
$ var xkcd = require('xkcd-api');
xkcd.latest(function(error, response) {
if (error) {
console.error(error);
} else {
console.log(response);
}
});
xkcd.get('comic-id', function(error, response) {
if (error) {
console.error(error);
} else {
console.log(response);
}
});
xkcd.random(function(error, response) {
if (error) {
console.error(error);
} else {
console.log(response);
}
});
Please make sure you've installed the package globally or are running it with npx.
xkcd-api
xkcd-api -l
xkcd-api --latest
xkcd-api -n 1714
xkcd-api --number 1714
xkcd-api -r
xkcd-api --random
You can raise an issue in this repo or mail me at [email protected]