Posted by admin July 5th 2018 at 13:07

var fs = require('fs');
var mysql = require('mysql');
var lineReader = require('readline');

var map = new Map();

var conn = mysql.createConnection({
host: '192.168.000.000',
user: 'xxxx',
password: 'xxxx',
database: 'xxxx'
});

var reader = lineReader.createInterface({
input: fs.createReadStream('file path','utf-8')
});

reader.on('line', function (line) {
//to do something...
});

reader.on('close', function () {
//to do something...
});