@ffflorian/xkcdjs v3.2.9
xkcdjs
An xkcd API client with a CLI.
Usage
A complete documentation is available at https://ffflorian.github.io/api-clients/packages/xkcdjs/.
CLI
To use xkcdjs
globally, run yarn global add @ffflorian/xkcdjs
or npm i -g @ffflorian/xkcdjs
.
Usage: xkcdjs [options] [command]
An xkcd API client with a CLI.
Options:
-v, --version output the version number
-o, --output <dir> Specify the output directory (default: current directory)
-h, --help output usage information
Commands:
latest Save the latest comic
random Save a random comic
number <index> Save comic by index number
Installation
Run yarn add @ffflorian/xkcdjs
or npm install @ffflorian/xkcdjs
.
Example
import {XKCD} from '@ffflorian/xkcdjs';
const xkcd = new XKCD();
xkcd.api.getLatest().then(result => {
// XKCDResult { ... }
});
xkcd.api.getRandom().then(result => {
// XKCDResult
});
xkcd.api.getById(2036).then(result => {
// XKCDResult
});
xkcd.api.getLatest({withData: true}).then(result => {
// XKCDResultWithData
});
xkcd.api.getRandom({withData: true}).then(result => {
// XKCDResultWithData
});
xkcd.api.getById(2036, {withData: true}).then(result => {
// XKCDResultWithData
});
Build and test
yarn
yarn test
14 days ago
4 months ago
11 months ago
12 months ago
1 year ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago