title: Nodejs: Writing a lot of files: createWriteStream or writeFile?
body: <p>I have to write a lot of files and I'm wondering which method suits best. The data are text.</p>
  
  <p>I'm a bit concerned on how I can close properly the operation. <code>createWriteStream</code> has a <code>end()</code> method or <code>fs.close()</code>, which closes the stream; <code>writeFile</code> has no such method if I well-understood, which may be inefficient after a long batch of write. All the examples of fs.writeFile never mention <code>fs.close()</code>.</p>