2.0.0 • Published 3 years ago

amongus-dumpy v2.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

amongus-dumpy

amongus-dumpy is a Node.js API wrapper to the Among Us Dumpy GIF Maker.

Requirements

You need Java 11 or above and Imagemagick installed (in the path) to use this library. You don't need to add it to the path if you provide the path to the java binary to the Dumpify() constructor; but by default, it points to the java binary in the path.

API

Dumpify(path?: string) constructor

The Dumpify() constuctor is the class constructor that contains the dumpify function that lets you dumpify an image. The constructor takes an optional string argument of the path to the java binary. This argument is not required since it defaults to just java which is the java binary in the path.

Example

const dumpy = new Dumpify("/path/to/java")

dumpify(opts: amongusopts): Buffer function

The dumpify() function is a function that does the dumpifying. This function is an async/promise function so use then() if you want to execute it or await if you are in an async function. The arguments it takes is an amongusopts Object which is what options you want to give to the function. The function returns a GIF in Buffer format so you can like write the image and stuff.

amongusopts object

The properties with the ? at the end of it are properties that arent required. This object is converted into CLI options.

The background property lets you choose a custom background for the GIF. You provide a Buffer to this property.

The file property is required and its what file you want to dumpify. You provide a Buffer to this property.

The lines property is the amount of among us dumpy lines you want in your gif. The more lines there is, the more high quality the image looks but at the cost of more memory usage. This property takes a number.

The mode property lets you choose if you want to use default among us crewmates or furry ones. This property takes a string.

The tmpdir string lets you choose where the CLI stores it's temp files. This also affects the temp files the lib creates for storing the Buffer you provided so it can give it to the CLI.

export interface amongusopts {
    background?: Buffer,
    file: Buffer,
    lines?: number,
    mode?: 'default' | 'furry',
    tmpdir?: string
}

Example

const dumpy = new Dumpify()
const buffer = fs.readFileSync('./image.png')
const buffer2 = dumpy.dumpify({
    file: buffer,
    lines: 10
})

Executable Example

You need an image to test with for this example. You can put a string in the Dumpy() constructor if you don't have java installed in the path.

const {default: Dumpify} = require('amongus-dumpy')
const fs = require('fs')
const path = require('path')
const dumpy = new Dumpify()
const buffer = fs.readFileSync('./image.png')
dumpy.dumpify({
    file: buffer
}).then((buffer2) => {
    fs.writeFileSync(path.join(__dirname, 'amongus.gif'), buffer2)
})
2.0.0

3 years ago

1.0.0

3 years ago