In node.js I have an array called jobs which I push file locations and images to. This happens 112 times every 13 seconds (each image/location is unique)
jobs.push(['/home/user/public_html/img/'+filename+'.png',canvas[n].toDataURL().replace(/^data:image\/\w+;base64,/,"")]);
Then I loop through all the jobs and write the files with fs
for(var job=0;job<jobs.length;job++){
fs.writeFile(jobs[job][0],(new Buffer(jobs[job][1],'base64')));
}
My question is; Can the file writing loop be done quicker?
This way the files are wrote to one after the other. I think it would be better to do them all at the same time since this happens only once per 13 seconds as a server job
could multiple instances of fs help?
var fs1=require('fs');
var fs2=require('fs');
var fs3=require('fs');
Or webworkers?? (I don't know about this in node)