G
G
gleendo2017-07-28 09:30:19
Node.js
gleendo, 2017-07-28 09:30:19

What are the methods of the child_process object, in particular exec and spawn, for?

I'm reading a book on node.js, but I didn't really understand the purpose of these methods. In addition, examples are given for unix systems.
Tried to use the win commands, but errors take off. For example, the java file was able to run. but the dir command fails to execute ... Yes, it’s not surprising, I didn’t understand at all what these methods are for and where they are used in practice, and how to work with them in general.
In the off-doc there are the same examples as in the book...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sasha, 2017-07-28
@madmages

child_process creates a child process.
In this child process, you can execute commands as from the console - the exec method.
Initially, a node is a single-threaded thing (physically located within one core and one thread), and this thing is made in order to be able to boot multi-core machines.
In general, there are many applications here, I converted the video on the node, or rather the node was just throwing commands to the console> ffmpeg

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question