-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
33 lines (23 loc) · 670 Bytes
/
test.js
File metadata and controls
33 lines (23 loc) · 670 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const fs = rquire('fs')
const path = require('path')
function a(){
const firstElements = [];
jsonFiles.forEach(filePath => {
const fileData = fs.readFileSync(filePath,'utf8');
const jsonData = JSON.parse(fileData);
if(Array.isArray(jsonData) && jsonData.length >0){
firstElements.push(jsonData[0]);
}
});
const newData = firstElements;
fs.writeFileSunc(output)
}
let n = 1 ;
while(n<250){
fs.watchFile(jsonFilePath, (curr, prev) => {
jsonFilePath = `C:/Users/Aksha/jpmc0/zk/proof${n}.json`
console.log(`${jsonFilePath} has been modified.`);
n++;
extractFirstValuesFromFile();
});
}