"calculate" in folders will now report the number of subfolders
Massimo Melina committed
Mar 11, 2026 at 10:33 UTC
87e2c8446b2c95a6a0648125cafa0666b2c3e52a
2 files changed
+14
-6
frontend/src/fileMenu.ts
+4
-1
@@ -164,7 +164,10 @@ export async function openFileMenu(entry: DirEntry, ev: MouseEvent, addToMenu: (
164
function showRes(data: any) {
165
return data && (
166
data.code ? err2msg(data)
167
- : h('span', {}, h(Bytes, _.pick(data,'bytes')), ' / ', t('n_files', { n: data.files.toLocaleString() }, '{n,plural,one{# file} other{# files}}') )
167
+ : h('span', {}, h(Bytes, _.pick(data,'bytes')),
168
+ ' / ', t('n_files', { n: data.files.toLocaleString() }, '{n,plural,one{# file} other{# files}}'),
169
+ ' / ', t('n_folders', { n: data.folders.toLocaleString() }, '{n,plural,one{# folder} other{# folders}}'),
170
+ )
171
)
172
}
173
}
src/frontEndApis.ts
+10
-5
@@ -138,12 +138,17 @@ export const frontEndApis: ApiHandlers = {
138
return new ApiError(ctx.status)
139
let bytes = 0
140
let files = 0
141
- for await (const n of walkNode(folder, { ctx, onlyFiles: true, depth: Infinity })) {
142
- bytes += await nodeStats(n).then(x => x?.size || 0, () => 0)
143
- files++
144
- partialFolderSize[id] = { bytes, files }
141
+ let folders = 0
142
+ for await (const n of walkNode(folder, { ctx, depth: Infinity })) {
143
+ if (n.isFolder)
144
+ folders++
145
+ else {
146
+ bytes += await nodeStats(n).then(x => x?.size || 0, () => 0)
147
+ files++
148
+ }
149
+ partialFolderSize[id] = { bytes, files, folders }
150
}
146
- return popKey(partialFolderSize, id) || { bytes, files }
151
+ return popKey(partialFolderSize, id) || { bytes, files, folders }
152
},
153
}
154