by jasondenizac · 13y ago · 0 comments
You also get to bring node's parallel io-centric patterns to your scripting. Need to download a bunch of files from a remote host, process them, and write them to disk? Go for it.
But take it with a grain of salt: it's very much a use-what-you-know kind of thing.
cat urls.txt | while read -r url; do
base="$(basename "$url")"
wget "$url" -O - -o "$base.log" | process > "$base" &
done
wait
For ad-hoc scripting, I tend to prefer bash, with anything remotely corresponding to heavy lifting assigned to the language with the best library / performance / whatever critical factor for it. Fork-join parallelism in bash is very easy. [enlive "1.1.1"]
instead of <dependency>
<groupId>enlive</groupId>
<artifactId>enlive</artifactId>
<version>1.1.1</version>
</dependency>