Last active
July 25, 2021 14:50
-
-
Save ridhwaans/26c3acffcf05739333f2183dd6aade08 to your computer and use it in GitHub Desktop.
file list to 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
// get line separated list without whitespace, newline, carriage return characters | |
const fs = require('fs'); | |
const path = require('path'); | |
const DIR_PATH = path.resolve(__dirname,'../subdirectory') | |
const list = fs.readFileSync(`${DIR_PATH}/list_to_read.txt`, "utf-8").split("\n").map(i => i.replace(/(\r\n|\n|\r)/gm, "")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment