Last active
February 12, 2017 01:41
-
-
Save viniciusCamargo/6baf32c13321977ce1f00957b99953a8 to your computer and use it in GitHub Desktop.
Read line and execute a child process (curl) with Node
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 lineReader = require('readline').createInterface({ | |
input: require('fs').createReadStream(process.argv[2]) | |
}) | |
lineReader.on('line', (line) => { | |
console.log('Reading ', line) | |
require('child_process').exec('curl -O ' + line, (err, stdout, stderr) => { | |
if (err) | |
throw err | |
console.log(stderr) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment