Skip to main content

Gif

const compressedFile = modfy.compress(
{
inputFiles: ['video.mp4'],
fps: 50,
loop: 0,
scale: 320
},
'sync' // Can be 'async' | 'sync' | 'client',
'https://yourdomain.com/modfyWebhook'
)

Arguments#

ParameterTypeDescription
fpsnumberSets the frames per second for the output GIF
loopnumberHow many times to loop (-1 = looping, 0 = infinite loop)
scalenumberSets the width of the GIF and automatically determines height to preserve aspect ratio

undefined Full class reference is below

Typing#

modfy.convert(
{
inputFiles: AcceptedFiles,
to: ToFile
},
processType: ProcessType,
webhookUrl?: string
): Promise<Uint8Array> | Promise<{ id: string, uuid: string }>
type ToFile = {
format: FormatKey // From the keys of the default formats
codec?: CodecKey // From the keys of the default codecs
}
type ProcessType = "sync" | "client" | "async"
/**
* This interface is a wrapper for a file object which takes a buffer
* with the mimeType and name of the file
*/
type ModfyFile = {
name: string
mimeType?: string
buffer: Buffer
}
type StoredFiles = File[] | ModfyFile[]
/**
* This type represents the accepted file inputs
*
* There are three accepted file input types
* 1. Array of Html File Object
* 2. Array of Strings, File Paths (Node only)
* 3. Array of {buffer, name, mimeType}
Here we are supporting buffers directly but require that you provide the name and mimeType
*/
type AcceptedFiles = StoredFiles | string[]

Caveats#

  • All files in the input array must be of same type
  • String paths are only supported in node