execFile()
The node:child_process function that runs a program directly, without a shell, and buffers its output.
In more detail
Arguments go in an array, so special characters in them are never interpreted. Use it instead of exec() whenever arguments come from users.
Related terms
- spawn() — The node:child_process function that starts a program with a list of arguments and gives you its standard input, output and error as streams.
- child_process.exec() — The node:child_process function that runs a whole command string through a shell and buffers all its output in memory.
- command injection — An attack where input meant as data, such as a file name or form field, gets run as commands because a program built code from it.
Taught in
- Child Processes: spawn, execFile, fork & IPC — Node.js Internals & Backend Services