0

I am trying to write to the end of a file when given the absolute path. So far, I have got this

  let data = '/Users/me/Documents/'
  const fs = require("fs");
  let proxy = 'this is a proxy'
  let dir = `${data}/hello/world/built.conf'`

  fs.writeFile(dir, proxy, {'flag': 'a'}, function(err) {
    if (err) {
        return console.error(err);
    }});

but never actually appends to the end of the file. I have added the flag to append at the end of the file. Any sort of help is appreciated! Thanks in advance for any help in regards to this.

Nutella43
  • 31
  • 5
  • 1
    Does this answer your question? [How to append to a file in Node?](https://stackoverflow.com/questions/3459476/how-to-append-to-a-file-in-node) – Joao Fernandes Jul 08 '20 at 02:11
  • Not really, I actually followed this question to write to a file but I am not sure if writing to a file with absolute path should require something else that I am missing – Nutella43 Jul 08 '20 at 02:49
  • [`fs.appendFile()`](https://nodejs.org/api/fs.html#fs_fs_appendfile_path_data_options_callback). – jfriend00 Jul 08 '20 at 03:07

0 Answers0