concept external application in category javascript
appears as: external applications, n external application, external application

This is an excerpt from Manning's book Node.js in Practice.
The child_process module provides four different methods for executing external applications. All methods are asynchronous. The right method will depend on what you need, as shown in figure 8.1.
execFile —Execute an external application, given a set of arguments, and callback with the buffered output after the process exits. spawn —Execute an external application, given a set of arguments, and provide a streaming interface for I/O and events for when the process exits.
If you want to run an external application and get the result, using execFile makes it simple and straightforward. It’ll buffer the output for you and provide the results and any errors in a callback. Let’s say we want to run the echo program given the parameters hello world. With execFile, we would do the following:
![]()
How does Node know where to find the external application? To answer that, we need to look at how paths work in the underlying operating system.