diff options
Diffstat (limited to 'src/api/server')
-rw-r--r-- | src/api/server/LocalApi.ts | 19 |
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 @@ | |||
1 | import { ExecException } from 'child_process'; | ||
1 | import { ipcRenderer } from 'electron'; | 2 | import { ipcRenderer } from 'electron'; |
2 | import du from 'du'; | 3 | import fastFolderSize from 'fast-folder-size'; |
3 | 4 | ||
4 | import { getServicePartitionsDirectory } from '../../helpers/service-helpers'; | 5 | import { 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 | ||