Created
July 24, 2014 14:24
-
-
Save mattdesl/7ca2f195c37d6ec55935 to your computer and use it in GitHub Desktop.
text files with JS
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 text = fs.readFileSync( __dirname + '/words.txt', 'utf8' ); | |
//split into an array | |
var words = text.trim().split(/\s+/); |
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
this | |
is | |
a | |
list | |
of | |
words |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment