title: fs.createWriteStream does not immediately create file?
body: <p>I have made a simple <em>download from http</em> function as below (error handling is omitted for simplifcation):</p>
  
  <pre class="lang-js prettyprint-override"><code>function download(url, tempFilepath, filepath, callback) {
      var tempFile = fs.createWriteStream(tempFilepath);
      http.request(url, function(res) {
          res.on('data', function(chunk) {
              tempFile.write(chunk);
          }).on('end', function() {
              tempFile.end();
              fs.renameSync(tempFile.path, filepath);
              return callback(filepath);
          })
      });
  }
  </code></pre>
  
  <p>However, as I call <code>download()</code> tens of times asynchronously, it seldom reports error on <code>fs.renameSync</code> complaining it cannot find file at <code>tempFile.path</code>. </p>
  
  <pre><code>Error: ENOENT, no such file or directory 'xxx'
  </code></pre>
  
  <p>I used the same list of urls to test it, and it failed about 30% of time. The same list of urls worked when downloaded one by one.</p>
  
  <p>Testing some more, I found out that the following code</p>
  
  <pre class="lang-js prettyprint-override"><code>fs.createWriteStream('anypath');
  console.log(fs.exist('anypath'));
  console.log(fs.exist('anypath'));
  console.log(fs.exist('anypath'));
  </code></pre>
  
  <p>does not always print <code>true</code>, but sometimes the first answer prints <code>false</code>.</p>
  
  <p>I am suspecting that too many asynchronous <code>fs.createWriteStream</code> calls cannot guarantee the file creation. Is this true? Are there any methods to guarantee file creation?</p>