1const fs = require('fs');
2
3fs.readFile('file.txt', function(err, data) {
4 if(err) throw err;
5
6 const arr = data.toString().replace(/\r\n/g,'\n').split('\n');
7
8 for(let i of arr) {
9 console.log(i);
10 }
11});
12
1var fs = require('fs');
2var myArray = fs.readFileSync('test.txt', 'utf8').split('\n');