MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / folderSize

Function folderSize

framework/utils/lib/utils.ts:44–62  ·  view source on GitHub ↗
(folderPath: string)

Source from the content-addressed store, hash-verified

42export const md5 = (content: string) => encrypt('md5', content);
43
44export function folderSize(folderPath: string) {
45 let size = 0;
46 const _next = function a(p: string) {
47 if (p) {
48 const stats = fs.statSync(p);
49 if (!stats.isDirectory() || stats.isSymbolicLink()) {
50 if (!stats.isSymbolicLink()) size += stats.size;
51 } else {
52 size += stats.size;
53 const files = fs.readdirSync(p);
54 if (Array.isArray(files)) {
55 for (const file of files) _next(path.join(p, file));
56 }
57 }
58 }
59 };
60 _next(folderPath);
61 return size;
62}
63
64String.prototype.format = function formatStr(...args) {
65 let result = this;

Callers 1

cache.tsFile · 0.90

Calls 1

_nextFunction · 0.85

Tested by

no test coverage detected