D
D
dailysse2017-09-06 13:33:26
Node.js
dailysse, 2017-09-06 13:33:26

How to execute such a command?

let spawn = require('child_process').spawn;

let ls = spawn('wget url');

ls.stdout.on('data', data => {
  console.log(data);
});

ls.on('error', err => console.log(err));

Good day to all. Above you can see that I am trying to download a file using the console wget. So I know that in order to execute a command with arguments, you need to pass the command itself and an array of arguments to spawn. Is there a way to do exactly as shown above? So that only a line is transferred. Maybe there are some special characters?
Thank you all in advance

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question