0

I need to execute a binary library (ffmpeg) from out of Foxx app. I see there is a built-in child_process module, but it doesn't have an exec method like Node.js has. Is there any other way to do so?

Thanks in advance

artnikpro
  • 5,487
  • 4
  • 38
  • 40

1 Answers1

1

since foxx is synchroneous I can only advise not to do this from foxx directly. The transcoding process will take time, which you don't want to block database resources for.

You should do this asynchroneous i.e. in a node process.

If you want to have a look how spawning processes works, this can be found in our unit testing suite:

https://github.com/arangodb/arangodb/blob/devel/js/client/modules/%40arangodb/testutils/process-utils.js#L878

require('internal') => {
executeExternal => launch a process to background
executeExternalAndWait => launch a process and wait for it to finish
killExternal => kill a launched process (only spawned processes can be send signals)
statusExternal => check for the status of an external process, either touch, or wait.
}

All spawned processes are kept on a list inside the server, only self-spawned process can be manipulated.

In modern ArangoDB this needs to be permitted by --javascript.allow-admin-execute else execution will be denied.

dothebart
  • 5,972
  • 16
  • 40
  • Thanks! Works good. I will run ffmpeg as a daemon so it will not block the db – artnikpro Sep 26 '16 at 20:14
  • @dothebart is there any other documentation available? That link is broken. – CoopDaddio Dec 07 '21 at 12:14
  • I've fixed the link and added the list of functions plus the commandline option documentation which is required nowadays. Sorry, there is no more official documentation. – dothebart Dec 15 '21 at 08:56