https://github.com/brecert/trivia-deno
simple deno module and cli to interact with OpenTDB
https://github.com/brecert/trivia-deno
Last synced: 4 months ago
JSON representation
simple deno module and cli to interact with OpenTDB
- Host: GitHub
- URL: https://github.com/brecert/trivia-deno
- Owner: brecert
- Created: 2022-04-10T22:25:28.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-04-15T06:31:31.000Z (about 3 years ago)
- Last Synced: 2025-02-04T22:06:33.252Z (5 months ago)
- Language: TypeScript
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Trivia
 [](https://shield.deno.dev/x/trivia_deno)
This package contains a typed fetch builder and some utils for working with the [OpenTDB](https://opentdb.com/) api.
# Usage
You can find more info in the [documentation](https://doc.deno.land/https://deno.land/x/trivia_deno/trivia.ts).
```ts
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)));
```