xkcd

A CLI and module to interact with the XKCD API

CLI Tool

Install

deno install  --allow-net --allow-write --allow-read https://deno.land/x/xkcd/cli.ts

Usage Examples

Download the latest comic:

xkcd

Download comic by ID:

xkcd -i 587 # or --id 587

Download all comics:

xkcd -a # --all

Specify a directory to download the images:

xkcd --all --dir data/

Builtin Help

xkcd --help

Module

Usage Example:

import xkcd from "https://deno.land/x/xkcd/mod.ts";

await xkcd();

A more extensive one:

import {
  randomXkcd,
  randomXkcdComicLink,
  xkcd,
  xkcdComicLink,
} from "https://deno.land/x/xkcd/mod.ts";

await xkcd(); //=> The latest XKCD comic metadata
await xkcdComicLink(); //=> The asset link of a the latest XKCD comic
await randomXkcd(); //=> A random XKCD comic metadata
await randomXkcdComicLink(); //=> The asset link of a random XKCD comic

API

xkcd

This is exported as default and as named export.

Returns the metadata of the latest xkcd comic.

Returns the image link of the latest xkcd comic.

randomXkcd

Returns the metadata of a random xkcd comic.

Returns a random comic link.

Licence

All here is licensed under the MIT Licence.