Created
July 17, 2019 14:59
-
-
Save deleteman/108f1174f6ba8e9b580b981554f9b6d0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const fs = require("fs") | |
async function read(fname) { | |
return new Promise( (resolve, reject) => { | |
fs.readFile(fname, (err, content) => { | |
if(err) return reject(err) | |
resolve(content.toString()) | |
}) | |
}) | |
} | |
(async () => { | |
let files = ['file1.json', 'file2.json'] | |
for(let i = 0; i < files.length; i++) { | |
let fcontent = await read(files[i]) | |
console.log(fcontent) | |
console.log("-------") | |
} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment