🖥
Node.js
Created
Mar 10, 2021 11:18 AM
Tags
Simple node.js demo
 
Node doesn't support client only server processing type
 
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(['input.mp4'], 'server', 30)

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(['input.mp4'], 'server', 30)

console.log('Processed!')

fs.writeFileSync('output.mp4', video)

}

main()