Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

get lines as list from file node js

const fs = require('fs');

fs.readFile('file.txt', function(err, data) {
    if(err) throw err;

    const arr = data.toString().replace(/
/g,'
').split('
');

    for(let i of arr) {
        console.log(i);
    }
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #lines #list #file #node #js
ADD COMMENT
Topic
Name
2+8 =