Convert more promise-fs
This commit is contained in:
parent
94ac21950d
commit
c41bb571f6
1 changed files with 4 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
|||
import { ipcRenderer } from "electron/renderer";
|
||||
import { existsSync } from "node:fs";
|
||||
import * as fs from "node:fs/promises";
|
||||
import path from "path";
|
||||
import { existsSync, mkdir, rmSync } from "promise-fs";
|
||||
import { DiskCache } from "../services/diskCache";
|
||||
|
||||
const ENTE_CACHE_DIR_NAME = "ente";
|
||||
|
@ -22,7 +23,7 @@ export async function openDiskCache(
|
|||
) {
|
||||
const cacheBucketDir = await getCacheBucketDir(cacheName);
|
||||
if (!existsSync(cacheBucketDir)) {
|
||||
await mkdir(cacheBucketDir, { recursive: true });
|
||||
await fs.mkdir(cacheBucketDir, { recursive: true });
|
||||
}
|
||||
return new DiskCache(cacheBucketDir, cacheLimitInBytes);
|
||||
}
|
||||
|
@ -30,7 +31,7 @@ export async function openDiskCache(
|
|||
export async function deleteDiskCache(cacheName: string) {
|
||||
const cacheBucketDir = await getCacheBucketDir(cacheName);
|
||||
if (existsSync(cacheBucketDir)) {
|
||||
rmSync(cacheBucketDir, { recursive: true, force: true });
|
||||
await fs.rm(cacheBucketDir, { recursive: true, force: true });
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue