Created
May 12, 2017 08:23
-
-
Save kiryuxxu/113886d0a5ead003a48b1ee54fa418b0 to your computer and use it in GitHub Desktop.
wget with child_process.spawn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stderr: --2017-05-12 17:21:27-- http://example.com/ | |
Resolving example.com... 93.184.216.34, 2606:2800:220:1:248:1893:25c8:1946 | |
Connecting to example.com|93.184.216.34|:80... | |
stderr: connected. | |
stderr: HTTP request sent, awaiting response... | |
stderr: 304 Not Modified | |
stderr: File ‘~/tmp/index.html’ not modified on server. Omitting download. | |
exit: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const spawn = require('child_process').spawn; | |
const cmd = spawn('wget', ['http://example.com', '-N', '-P', '~/tmp']); | |
cmd.stdout.on('data', (data) => { | |
console.log('stdout: ' + data.toString()); | |
}); | |
cmd.stderr.on('data', (data) => { | |
console.log('stderr: ' + data.toString()); | |
}); | |
cmd.on('exit', (code) => { | |
console.log('exit: ' + code); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment