Skip to content

Instantly share code, notes, and snippets.

@viniciusCamargo
Last active February 12, 2017 01:41
Show Gist options
  • Save viniciusCamargo/6baf32c13321977ce1f00957b99953a8 to your computer and use it in GitHub Desktop.
Save viniciusCamargo/6baf32c13321977ce1f00957b99953a8 to your computer and use it in GitHub Desktop.
Read line and execute a child process (curl) with Node
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