You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
560 B
24 lines
560 B
|
4 years ago
|
import { promises as fs } from 'fs';
|
||
|
|
const eventFiles = process.argv.slice(3);
|
||
|
|
|
||
|
|
(async () => {
|
||
|
|
const root = '/home/zalox/src/acne/lib/derma';
|
||
|
|
|
||
|
|
let requests = 0;
|
||
|
|
|
||
|
|
const promises = eventFiles.map(async (filename) => {
|
||
|
|
const path = `${root}/${filename}`;
|
||
|
|
const file_content = await fs.readFile(path, { encoding: 'utf-8' });
|
||
|
|
const j = JSON.parse(file_content);
|
||
|
|
console.log(path);
|
||
|
|
return j.length;
|
||
|
|
});
|
||
|
|
|
||
|
|
for (let i = 0; i < promises.length; i++) {
|
||
|
|
const l = await promises[i];
|
||
|
|
requests += l;
|
||
|
|
}
|
||
|
|
|
||
|
|
console.log(requests);
|
||
|
|
})();
|