code: function writeFile(path,content) {
      return when.promise(function(resolve,reject) {
          var stream = fs.createWriteStream(path);
          stream.on('open',function(fd) {
              stream.end(content,'utf8',function() {
                  fs.fsync(fd,resolve);
              });
          });
          stream.on('error',function(err) {
              reject(err);
          });
      });
  }
docs: Write content to a file using UTF8 encoding.
  This forces a fsync before completing to ensure
  the write hits disk.