Write a buffer synchronously to the file and flush to disk.
function writeBuffer(buffer) {
  var written = fs.writeSync(this.fd, buffer, 0, buffer.length, null);
  fs.fsyncSync(this.fd);
  return written;
}