From 7c04d50a99a6b9372d6eea08f69698f4bdd235d1 Mon Sep 17 00:00:00 2001 From: William Harrison Date: Fri, 26 May 2023 18:24:44 +0800 Subject: [PATCH] Delete raw-api.js --- scripts/raw-api.js | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 scripts/raw-api.js diff --git a/scripts/raw-api.js b/scripts/raw-api.js deleted file mode 100644 index 464747f..0000000 --- a/scripts/raw-api.js +++ /dev/null @@ -1,45 +0,0 @@ -const fs = require("fs"); -const path = require("path"); - -const directoryPath = path.join(__dirname, "../sub-logs"); - -let combinedArray = []; - -fs.readdir(directoryPath, function (err, files) { - if(err) throw err; - - function removeValue(value, index, arr) { - if(value === "reserved") { - arr.splice(index, 1); - return true; - } - - return false; - } - - files.filter(removeValue); - - files.forEach(function (file) { - const filePath = path.join(directoryPath, file); - - fs.readFile(filePath, "utf8", (err, data) => { - if(err) throw err; - - const dataArray = [JSON.parse(data)]; - - for(const item of dataArray) { - delete item.owner.email; - - item.domain = path.parse(file).name + ".is-a-good.dev"; - } - - combinedArray = combinedArray.concat(dataArray); - - if(combinedArray.length === files.length) { - fs.writeFile("utils/raw.json", JSON.stringify(combinedArray), (err) => { - if(err) throw err; - }) - } - }) - }) -})