aboutsummaryrefslogtreecommitdiffstats
path: root/src/api
diff options
context:
space:
mode:
authorLibravatar Markus Hatvan <markus_hatvan@aon.at>2021-10-12 17:42:17 +0200
committerLibravatar GitHub <noreply@github.com>2021-10-12 17:42:17 +0200
commit68a04f90633346cf48aa01ae44c6757c47c37965 (patch)
treef5ad7f927e9b9e391abdda8f72fc9cc375b8c427 /src/api
parent5.6.3-nightly.31 [skip ci] (diff)
downloadferdium-app-68a04f90633346cf48aa01ae44c6757c47c37965.tar.gz
ferdium-app-68a04f90633346cf48aa01ae44c6757c47c37965.tar.zst
ferdium-app-68a04f90633346cf48aa01ae44c6757c47c37965.zip
chore: replace deprecated du with fast-folder-size (#2050)
Diffstat (limited to 'src/api')
-rw-r--r--src/api/server/LocalApi.ts19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/api/server/LocalApi.ts b/src/api/server/LocalApi.ts
index 19eacf9ff..1a46aaefe 100644
--- a/src/api/server/LocalApi.ts
+++ b/src/api/server/LocalApi.ts
@@ -1,5 +1,6 @@
1import { ExecException } from 'child_process';
1import { ipcRenderer } from 'electron'; 2import { ipcRenderer } from 'electron';
2import du from 'du'; 3import fastFolderSize from 'fast-folder-size';
3 4
4import { getServicePartitionsDirectory } from '../../helpers/service-helpers'; 5import { getServicePartitionsDirectory } from '../../helpers/service-helpers';
5 6
@@ -29,13 +30,19 @@ export default class LocalApi {
29 // Services 30 // Services
30 async getAppCacheSize() { 31 async getAppCacheSize() {
31 const partitionsDir = getServicePartitionsDirectory(); 32 const partitionsDir = getServicePartitionsDirectory();
33
32 return new Promise((resolve, reject) => { 34 return new Promise((resolve, reject) => {
33 du(partitionsDir, {}, (err: Error | null, size?: number | undefined) => { 35 fastFolderSize(
34 if (err) reject(err); 36 partitionsDir,
37 (err: ExecException | null, bytes: number | undefined) => {
38 if (err) {
39 reject(err);
40 }
35 41
36 debug('LocalApi::getAppCacheSize resolves', size); 42 debug('LocalApi::getAppCacheSize resolves', bytes);
37 resolve(size); 43 resolve(bytes);
38 }); 44 },
45 );
39 }); 46 });
40 } 47 }
41 48