(file, index)
| 11 | ]; |
| 12 | |
| 13 | function formatFile(file, index) { |
| 14 | fs.readFile(file, "utf8", (err, content) => { |
| 15 | if (err) throw err; |
| 16 | fs.writeFile(file, JSON.stringify( JSON.parse(content), null, 4), (err) => { |
| 17 | if (err) throw err; |
| 18 | console.log(`formatting file ${file} done`); |
| 19 | }); |
| 20 | }); |
| 21 | } |
| 22 | |
| 23 | fileList.forEach(formatFile); |