title: How to append new row in exist csv file in nodejs json2csv?
body: <p>I want to add new row in exist csv file? if csv file exist, then i don't want to add column header and just want to add new row after exist row in the file.</p>
  
  <p>Here is code which I'm trying:</p>
  
  <pre><code>var fields = ['total', 'results[0].name.val'];
  var fieldNames = ['Total', 'Name'];
  
  var opts1 = {
    data: data,
    fields: fields,
    fieldNames: fieldNames,
    newLine: '\r\n'
  
  };
  
  var opts2 = {
    newLine: '\r\n',
    data: data,
    fields: fields,
    fieldNames: fieldNames,
    hasCSVColumnTitle: false,
  
  };
  
  fs.stat('file.csv', function (err, stat) {
    if (err == null) {
      console.log('File exists');
      var csv = json2csv(opts2);
      fs.appendFile('file.csv', csv, function (err) {
        if (err) throw err;
        console.log('The "data to append" was appended to file!');
      });
    } else if (err.code == 'ENOENT') {
      // file does not exist
      var csv = json2csv(opts1);
      fs.writeFile('file.csv', csv, function (err) {
        if (err) throw err;
        console.log('file saved');
      });
    } else {
      console.log('Some other error: ', err.code);
    }
  });
  </code></pre>