imgen
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Image Gen

This is an api wrapper built for apis compatible with DankMemer's imagen. They privatized their public instance, so I've made my own along with this wrapper that uses my instance by default, but is compatible with any instances that function the same.

JavaScript Example:

const ImageGenAPI = require("imgen");
const { writeFile } = require("fs/promises");
// only apiKey is required
const gen = new ImageGenAPI({ apiKey: "api key", userAgent: "SomeUserAgent/1.0.0", baseURL: "https://imgen.yiff.rest/api" });
gen.abandon("text to provide").then(response => writeFile(`${__dirname}/abandon.png`, response.file));

TypeScript Example:

import ImageGenAPI from "imgen";
import { writeFile } from "fs/promises";
// only apiKey is required
const gen = new ImageGenAPI({ apiKey: "api key", userAgent: "SomeUserAgent/1.0.0", baseURL: "https://imgen.yiff.rest/api" });
gen.abandon("text to provide").then(response => writeFile(`${__dirname}/abandon.png`, response.file));

The return of the functions is this structure (using the TS interface as an example):

interface RequestResponse {
    ext: string;
    mime: string;
    file: Buffer;
}

ext will be the file extension of what was returned, mime will be the mime type of what was returned, and file will be the actual data returned.

The only function that differentiates from this is the yomomma function, which returns just a string.

Package Sidebar

Install

npm i imgen

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

59.5 kB

Total Files

13

Last publish

Collaborators

  • donovan_dmc