code: function writeFile(filePath, data, callback, count){ // callback(err)
      if(typeof callback !== 'function') throw new Error('Wrong arguments');
      filePath = path.resolve(filePath);
      
      count = count || 0;
      var maxLimit = 5; // 5 * 500ms = 2,5s
      
      fs.writeFile(filePath, data, function(err) {
          if(err) {
              if(count >= maxLimit) callback(new Error('fsExt.writeFile: max repeat limit reached').cause(err)); // repeat limit reached
              else setTimeout(function(){
                  writeFile(filePath, data, callback, count + 1);
              }, 500);
          }
          else callback();
      });
  }
docs: very simple write repeater, when gets error, try repeat after 500ms, but max 5 times
  @param {String} filePath
  @param {String} data to write to file
  @param {Function} callback(err)