Last active
October 9, 2017 13:15
-
-
Save rafaelmaeuer/b175eacdcc4e2f0ca4d89cbd631638fe to your computer and use it in GitHub Desktop.
node.js: read a text file into an array - From https://stackoverflow.com/questions/6831918/node-js-read-a-text-file-into-an-array-each-line-an-item-in-the-array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var array = fs.readFileSync('file.txt').toString().split("\n"); | |
for(i in array) { | |
console.log(array[i]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment