title: How to save csv data into .csv file in nodejs?
body: <p>This is my &quot;app.js&quot; file.</p>
  <pre><code>const { convertArrayToCSV } = require('convert-array-to-csv');
  const converter = require('convert-array-to-csv');
  const fs = require('fs')
  const csv = require('csv-parser')
  const randomWords = require('random-words')
  const header = ['number', 'first', 'last', 'handle'];
  
  const dataArrays = [
  [1, 'Mark', 'Otto', '@mdo'],
  [2, 'Jacob', 'Thornton', '@fat'],
  [3, 'Larry', 'the Bird', '@twitter'],
  ];
  const val = convertArrayToCSV(dataArrays, {
  header,
  separator: ','
  });
  console.log(val)
  </code></pre>
  <p><strong>output:</strong></p>
  <pre><code>number,first,last,handle
  1,Mark,Otto,@mdo  
  2,Jacob,Thornton,@fat
  3,Larry,the Bird,@twitter
  </code></pre>
  <p>I  want to save this &quot;Val&quot; as a .csv file on my device.
  How can I do that? Please help. I am stuck here for the last 4 hours.</p>