Skip to content

Instantly share code, notes, and snippets.

@EmmanuelKasper

EmmanuelKasper/wget.js

Last active Aug 8, 2018
Embed
What would you like to do?
Nodejs shell like programming: calling an external command and returning output to stdout
#! env node
// execFileSync will call the command directly without using a shell, a tad faster and prevents interpretation of characters
// ( similar to C and java exec )
const exec = require('child_process').execFileSync;
// inherit will use the stdio of the parent process, ie this nodejs script
exec('wget', ['https://git.kernel.org/torvalds/t/linux-4.18-rc8.tar.gz', '--output-document', '/tmp/bla'], {stdio:'inherit'});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment