fixed error with lowdb

This commit is contained in:
JP-Garcia 2024-09-30 19:54:33 -05:00 committed by GitHub
parent c8cf7362fa
commit 11161443e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,8 +11,9 @@ export const dataDir = s => path.resolve(__dirname, '..', 'data', s);
export const resolve = (...a) => a.length && a[0] == '0' ? null : path.resolve(...a); export const resolve = (...a) => a.length && a[0] == '0' ? null : path.resolve(...a);
// json database // json database
import { JSONFilePreset } from 'lowdb/node'; import { LowSync } from "lowdb";
export const jsonDb = (file, defaultData) => JSONFilePreset(dataDir(file), defaultData); import { JSONFileSync } from "lowdb/node";
export const jsonDb = (file, defaultData) => new LowSync(new JSONFileSync(dataDir(file)), defaultData);
export const delay = ms => new Promise(resolve => setTimeout(resolve, ms)); export const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
// date and time as UTC (no timezone offset) in nicely readable and sortable format, e.g., 2022-10-06 12:05:27.313 // date and time as UTC (no timezone offset) in nicely readable and sortable format, e.g., 2022-10-06 12:05:27.313