replace Fs API where possible

This commit is contained in:
marlonerler
2024-07-05 19:58:42 +02:00
parent fbc165f7c0
commit f82e874ac0
2 changed files with 3 additions and 9 deletions
+2 -4
View File
@@ -1,5 +1,3 @@
import Fs from "fs/promises";
// CONFIG
const configPath = "config.json";
@@ -12,12 +10,12 @@ export const defaultConfig = {
// METHODS
export async function createConfig() {
const configString = JSON.stringify(defaultConfig, null, 4);
await Fs.writeFile(configPath, configString);
await Bun.write(configPath, configString);
}
export async function getConfig(): Promise<typeof defaultConfig> {
try {
const configString = (await Fs.readFile(configPath)).toString();
const configString = await Bun.file(configPath).text();
const configObject = JSON.parse(configString);
Object.keys(defaultConfig).forEach((key) => {