Skip to main content
Deno 2 is finally here 🎉️
Learn more

Trivia

@brecert/trivia deno module

This package contains a typed fetch builder and some utils for working with the OpenTDB api.

Usage

You can find more info in the documentation.

import {
  Encoding,
  triviaFetch,
  decodeQuestion,
} from "https://deno.land/x/trivia_deno/trivia.ts";

const questions = await triviaFetch({
  amount: 5,
  encode: Encoding.Base64,
  token: undefined,
})
  .then((res) => res.json())
  .then((res) => res.results.map((res) => decodeQuestion(res, atob)));