Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/donovandmc/imagegenapi
An api wrapper for imagen.yiff.rest and similar services.
https://github.com/donovandmc/imagegenapi
Last synced: about 1 month ago
JSON representation
An api wrapper for imagen.yiff.rest and similar services.
- Host: GitHub
- URL: https://github.com/donovandmc/imagegenapi
- Owner: DonovanDMC
- License: mit
- Created: 2022-06-19T15:46:22.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-06-28T12:50:06.000Z (over 1 year ago)
- Last Synced: 2024-11-16T10:36:35.522Z (about 2 months ago)
- Language: TypeScript
- Size: 37.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Image Gen
This is an api wrapper built for apis compatible with [DankMemer's imagen](https://github.com/DankMemer/imgen). They privatized their public instance, so I've made my own along with this wrapper that uses [my instance](https://imgen.yiff.rest/) by default, but is compatible with any instances that function the same.[![](https://nodei.co/npm/imgen.png)](https://npm.im/imgen)
## JavaScript Example:
```js
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:
```ts
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):
```ts
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.