title: node.js how to insert string to beginning of file but not replace the original text?
body: <p>The code below inserted <code>somestring</code> to file but also will replace the text inside the file. how can fix this?</p>
  
  <pre><code>fd = fs.openSync('file', 'r+')
  buf = new Buffer('somestring')
  fs.writeSync(fd, buf, 0, buf.length, 0)
  fs.close(fd)
  </code></pre>