fixed error with lowdb
This commit is contained in:
parent
c8cf7362fa
commit
11161443e1
1 changed files with 3 additions and 2 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue