title: How to download audio file from URL in Node.js?
body: <p>How to download audio file from URL and store it in local directory?
  I'm using Node.js and I tried the following code:</p>
  
  <pre><code>var http = require('http');
  var fs = require('fs');
  var dest = 'C./test'
  var url= 'http://static1.grsites.com/archive/sounds/comic/comic002.wav'
  function download(url, dest, callback) {
    var file = fs.createWriteStream(dest);
    var request = http.get(url, function (response) {
      response.pipe(file);
      file.on('finish', function () {
        file.close(callback); // close() is async, call callback after close completes.
      });
      file.on('error', function (err) {
        fs.unlink(dest); // Delete the file async. (But we don't check the result)
        if (callback)
          callback(err.message);
      });
    });
  }
  </code></pre>
  
  <p>No error occured but the file has not been found.</p>