replace
replace copied to clipboard
Use concurrency limit to prevent EMFILE errors
Something like
var queue = require("queue-async")
var q = queue(opts.concurrency || 250)
// ... for each file ...
q.defer(replace)
//before terminating
q.awaitAll()
Of interest: https://github.com/isaacs/node-graceful-fs
Thanks. Interestingly, I tried graceful, and it was slower than synchronous on most code bases I tried. I just kind of accepted it and didn't dig into it too hard.