-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Michael B. Gale
committed
Oct 29, 2024
1 parent
19e7c25
commit 51d90f4
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { Logger } from "./logging"; | ||
| import { tryGetFolderBytes } from "./util"; | ||
|
|
||
| /** | ||
| * Returns the total size of all the specified paths. | ||
| * @param paths The paths for which to calculate the total size. | ||
| * @param logger A logger to record some informational messages to. | ||
| * @returns The total size of all specified paths. | ||
| */ | ||
| export async function getTotalCacheSize( | ||
| paths: string[], | ||
| logger: Logger, | ||
| ): Promise<number> { | ||
| const sizes = await Promise.all( | ||
| paths.map((cacheDir) => tryGetFolderBytes(cacheDir, logger)), | ||
| ); | ||
| return sizes.map((a) => a || 0).reduce((a, b) => a + b, 0); | ||
| } |