title: how to import csv file into postgresql using node js?
body: <p>I am new to node js.</p>
  
  <p>I have a csv file in my local system that I want to upload it local PostgreSQL Database using node js.</p>
  
  <p>I am trying the following code:</p>
  
  <pre><code>var csv = require('csv-stream');
  var request = require('request');
  var fs = require('fs');
  
  // All of these arguments are optional.
  var options = {
      delimiter : '\t', // default is ,
      endLine : '\n', // default is \n,
  // by default read the first line and use values found as columns 
     // columns : ['Settlement Ref No.', 'Order Type','Fulfilment Type','Seller SKU','wsn'],
      escapeChar : '"', // default is an empty string
      enclosedChar : '"' // default is an empty string
  }
  
  var csvStream = csv.createStream(options);
   fs.createReadStream('C:\\Users\\YAM\\Documents\\fk_starchi.csv').pipe(csvStream)
      .on('error',function(err){
          console.error(err);
      })
      .on('data',function(data){
          // outputs an object containing a set of key/value pair representing a line found in the csv file.
         // console.log(data);
      })
      .on('column',function(key,value){
          // outputs the column name associated with the value found
        // console.log('#' + key + ' = ' + value);
          console.log('# '   + value);
  
      })
  </code></pre>
  
  <p>Its reading data .
  now i want to import it on postgrsql database.</p>
  
  <p>Where can I get a tutorial or any other help to do this.</p>