(jsonArray)
| 29 | }); |
| 30 | |
| 31 | function saveNodeArray(jsonArray) { |
| 32 | const array = JSON.parse(jsonArray); |
| 33 | const json = JSON.stringify({ items: array }); |
| 34 | const filePath = __dirname + "/../src/assets/nodes.json"; |
| 35 | |
| 36 | fs.writeFile(filePath, json, (err) => { |
| 37 | if (err) { |
| 38 | console.error("Error writing JSON to file:", err); |
| 39 | } else { |
| 40 | console.log("JSON written to file successfully"); |
| 41 | } |
| 42 | }); |
| 43 | } |