code: function update(self, callback) {
    self.updated = false;
  
    // convert state to a string
    var state = self.state;
    if (typeof state === 'object' && state !== null) {
      state = JSON.stringify(state);
    } else {
      state = state.toString();
    }
  
    // clean write to fd
  	var buffer = new Buffer(state);
  	fs.truncate(self.fd, 0, function (error) {
      if (error) return callback(error);
  
  		fs.write(self.fd, buffer, 0, buffer.length, 0, function (error) {
        callback(error || null);
  		});
  	});
  }
docs: update file