Fix promisify warning

This commit is contained in:
Cohee 2024-01-25 21:37:42 +02:00
parent 515e3859ec
commit aa1d2a7260
1 changed files with 1 additions and 3 deletions

View File

@ -2,10 +2,8 @@ const fs = require('fs');
const path = require('path');
const express = require('express');
const writeFileAtomic = require('write-file-atomic');
const util = require('util');
const crypto = require('crypto');
const writeFile = util.promisify(writeFileAtomic);
const readFile = fs.promises.readFile;
const readdir = fs.promises.readdir;
@ -168,7 +166,7 @@ async function saveStatsToFile() {
if (charStats.timestamp > lastSaveTimestamp) {
//console.debug("Saving stats to file...");
try {
await writeFile(statsFilePath, JSON.stringify(charStats));
await writeFileAtomic(statsFilePath, JSON.stringify(charStats));
lastSaveTimestamp = Date.now();
} catch (error) {
console.log('Failed to save stats to file.', error);