Fix promisify warning
This commit is contained in:
parent
515e3859ec
commit
aa1d2a7260
|
@ -2,10 +2,8 @@ const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const writeFileAtomic = require('write-file-atomic');
|
const writeFileAtomic = require('write-file-atomic');
|
||||||
const util = require('util');
|
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
|
|
||||||
const writeFile = util.promisify(writeFileAtomic);
|
|
||||||
const readFile = fs.promises.readFile;
|
const readFile = fs.promises.readFile;
|
||||||
const readdir = fs.promises.readdir;
|
const readdir = fs.promises.readdir;
|
||||||
|
|
||||||
|
@ -168,7 +166,7 @@ async function saveStatsToFile() {
|
||||||
if (charStats.timestamp > lastSaveTimestamp) {
|
if (charStats.timestamp > lastSaveTimestamp) {
|
||||||
//console.debug("Saving stats to file...");
|
//console.debug("Saving stats to file...");
|
||||||
try {
|
try {
|
||||||
await writeFile(statsFilePath, JSON.stringify(charStats));
|
await writeFileAtomic(statsFilePath, JSON.stringify(charStats));
|
||||||
lastSaveTimestamp = Date.now();
|
lastSaveTimestamp = Date.now();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('Failed to save stats to file.', error);
|
console.log('Failed to save stats to file.', error);
|
||||||
|
|
Loading…
Reference in New Issue