Skip to main content

Compress

Are bloated video file sizes getting you down and making you question your existence? Snap out of that existential crisis with the compress operation!

const compressedFile = modfy.compress(
{
inputFiles: ['video.mp4'],
compressValue: 50 // Between 1 - 100, 100 is maximum compression
},
'sync' // Can be 'async' | 'sync' | 'client',
'https://yourdomain.com/modfyWebhook'
)

Arguments#

ParameterTypeDescription
compressValuenumberHow much to compress [0 - 100]

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