Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

relevant-xkcd

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

relevant-xkcd

Gets relevant XKCD comics.

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

Relevant XKCD

Simple XKCD comic fetcher.
Uses Promises and not callbacks!

Example

const xkcd = require('relevant-xkcd');
xkcd.fetchRelevant('meta').then(console.log);

Output

  {
    id: 917,
    day: 27,
    month: 6,
    year: 2011,
    date: 2011-06-27, // Date object.
    title: 'Hofstadter',
    safeTitle: 'Hofstadter',
    transcript: '[...]', // Too long for here!
    altText: '[...]',
    xkcdURL: 'https://xkcd.com/917',
    imageURL: 'https://imgs.xkcd.com/comics/hofstadter.png',
    explainURL: 'http://www.explainxkcd.com/wiki/index.php/917'
  }

Methods

xkcd.fetchComic([id])

Fetches a comic.
ID can be left blank for current comic.
=> Promise<Comic>

xkcd.fetchCurrent()

Fetches the current comic.
=> Promise<Comic>

xkcd.fetchRandom()

Fetches a random comic.
=> Promise<Comic>

xkcd.fetchRelevant(query)

Fetches a comic relevant to query.
Uses Relevant XKCD.
=> Promise<Comic>

xkcd.fetchAllRelevant(query)

Fetches comics relevant to query.
Comics are sorted by descending relevancy.
=> Promise<Comic[]>

comic.fetchImage()

Fetches the image buffer of a comic.
=> Promise<Buffer>

FAQs

Package last updated on 08 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc