Created
September 4, 2018 18:13
-
-
Save kmaher9/15111dc2182c7ee8d06db042b627ce2c to your computer and use it in GitHub Desktop.
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 businessFiles = fs.readdirSync(businessPath) // retrieve directory listing | |
var techFiles = fs.readdirSync(techPath) | |
for (var i = 0; i < businessFiles.length; i++) { | |
var file = businessFiles[i] | |
var content = fs.readFileSync(businessFiles + "\\" + file) // opens the file as a stream, reading the whole file into memory | |
inputs.push({input: content.toString(), output: 'business' }) // the entire file content is stored in a two dimensional array | |
} | |
for (var i = 0; i < techFiles.length; i++) { | |
var file = techFiles[i] | |
var content = fs.readFileSync(techFiles + "\\" + file) | |
inputs.push({input: content.toString(), output: 'tech' }) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment