Skip to main content

Simple Node

Simple node.js demo

Node doesn't support client processing type

Modern JS#

import * as fs from 'fs'
import Modfy from '@modfy/core'
const modfy = new Modfy({
token : '',
secretToken : '',
clientSide : false // Remember node doesn't support client
})
const main = async () => {
const video = await modfy.compress({inputFiles:['input.mp4'], compressValue: 30}, 'server')
console.log('Processed!')
fs.writeFileSync('output.mp4', video)
}
main()

ES5#

const fs = require('fs')
const Modfy = require('@modfy/core')
const modfy = new Modfy.default({
token : '',
secretToken : '',
clientSide : false // Remember node doesn't support client
})
const main = async () => {
const video = await modfy.compress({inputFiles:['input.mp4'], compressValue: 30}, 'sync')
console.log('Processed!')
fs.writeFileSync('output.mp4', video)
}
main()