sra-wrapper
v1.0.1
Published
An unofficial wrapper around Some Random API
Downloads
4
Readme
sra-wrapper
An unofficial wrapper around Some Random API.
Usage
This package is designed as an easy replacement to the official wrapper (that is apparently unmaintained).
Here's an example snippet:
const { api } = require("sra-wrapper");
// `/img/dog` translates to `api.img.dog()`
api.img.dog().then(({ link }) => {
console.log(link);
})
This package follows the same naming conventions as the original URLs, with a couple differences:
- All names follow camelCase.
This means that names such asred_panda
andyoutube-comment
becomeredPanda
andyoutubeComment
. - The
binary
and thebase64
endpoints are split.
Becausebinary
andbase64
do different things based on the arguments, they've been split intoencodeBinary
/encodeBase64
anddecodeBinary
/decodeBase64
. - The endpoints that don't have a category are grouped within the
other
category.
Examples
const { api } = require("sra-wrapper");
const { writeFileSync } = require("fs");
api.canvas.youtubeComment({
avatar: "https://cdn.discordapp.com/avatars/280399026749440000/ed7c437fbce145a31581f0b8796e70d9.png?size=1024",
comment: "This is a YouTube comment",
username: "Samplasion"
}).then(buffer => {
writeFileSync("youtube.png", buffer);
})