convert text file to array javascript code example
Example 1: javascript convert file to array
var fs = require('fs');
var text = fs.readFileSync("./mytext.txt", 'utf-8');
var textByLine = text.split('\n')
Example 2: javascript store text file into string
var fs = require("fs");
fs.readFile("./mytext.txt", function(text){
var textByLine = text.split("\n")
});