fix: create empty certs.json when it doesn't exist

pull/25/head
Derick Olson 2023-06-28 17:40:11 -04:00
rodzic b260ca5726
commit f55e5fc8d0
1 zmienionych plików z 4 dodań i 2 usunięć

Wyświetl plik

@ -50,8 +50,10 @@
const filepath = type === "signing" ? CertsHistory.signingFilepath : CertsHistory.timestampingFilepath;
if (!fs.readFileSync(filepath)) {
fs.writeFileSync(filepath, "{}");
try {
fs.readFileSync(filepath)
} catch (err) {
fs.writeFileSync(filepath, "{}")
}
return JSON.parse(fs.readFileSync(filepath));