Nodejs File Read fs.readFile

Here you can find the source of fs.readFile

Method Source Code

var fs = require('fs');

fs.readFile('rule.txt', function(err, data){
   if (err) {console.log(err);return;}

   var data = data.toString();

   data = data.split(/\n|\r/g).trimNull();
   console.log(data);/*from  w  w  w.  j  av  a  2 s .com*/
});

Related

  1. fs.readFile
    var fs = require("fs");
    var x = [];
    for (var i = 0; i < 6; i++) {
        x.push([]);
        for (var j=0; j<50; j++) {
            x[i].push(" ");
    fs.readFile("l8.txt", "utf8", function (e, d) {
    ...