Antes de esto, presentemos una lectura de línea por línea de la NPM: https://github.com/nickewing/line-reader. Los amigos que lo necesitan pueden echar un vistazo.
Cargue directamente el código:
function readLines (input, func) {var restante = ''; input.on ('data', function (data) {resting + = data; var index = restante.indexof ('/n'); while (index> -1) {var line = restante.substring (0, index); restos = remurning.substring (index + 1); func (línea); index = restante.indexof ('/n');}); input.on ('end', function () {if (restante.length> 0) {func (restante);}});} function func (data) {Container.push (data);} var input = fs.CreateReadStream (__ dirname + '/ip_arr.txt') n.