real-size 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -11
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/real-size +0 -0
- package/prebuilds/darwin-x64/real-size +0 -0
- package/prebuilds/linux-arm64/real-size +0 -0
- package/prebuilds/linux-x64/real-size +0 -0
- package/prebuilds/win32-arm64/real-size.exe +0 -0
- package/prebuilds/win32-x64/real-size.exe +0 -0
- package/skill/SKILL.md +1 -1
package/README.md
CHANGED
|
@@ -125,6 +125,11 @@ real-size: and 3 more entries could not be read
|
|
|
125
125
|
/Users/me/Library: at least 2.1 GB private, 9.8 GB allocated, 210377 files (4 entries could not be read)
|
|
126
126
|
```
|
|
127
127
|
|
|
128
|
+
A volume mounted inside the tree whose filesystem cannot report what deleting
|
|
129
|
+
it would free, for example a FAT or HFS+ disk image or an FSKit volume on
|
|
130
|
+
macOS, is skipped the same way, as one entry, with the reason "another
|
|
131
|
+
filesystem that cannot report private size". Nothing in it is counted.
|
|
132
|
+
|
|
128
133
|
The sizes are then lower bounds: `skipped` counts the entries left out and
|
|
129
134
|
`exact` is `false`. Like `du`, the command prints the result and exits with
|
|
130
135
|
status 1. An entry deleted while the walk runs is not an error: it frees
|
|
@@ -134,7 +139,7 @@ nothing, so it is left out without a message and does not count in `skipped`.
|
|
|
134
139
|
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
135
140
|
| 0 | Every path was measured in full. |
|
|
136
141
|
| 1 | Some entries could not be read: the result is on stdout with `skipped` above 0. Or a usage error, or a path itself could not be read: the reason is on stderr, stdout is empty. |
|
|
137
|
-
| 2 | The filesystem cannot report what deleting
|
|
142
|
+
| 2 | The filesystem a path itself is on cannot report what deleting it would free. Stdout is empty. |
|
|
138
143
|
|
|
139
144
|
With exit status 1, a result on stdout tells the two cases apart.
|
|
140
145
|
|
|
@@ -190,8 +195,9 @@ TypeScript types are included. Node `^20.19.4 || >=22.12.0`.
|
|
|
190
195
|
- `files`: the regular files counted, each hard-linked file once.
|
|
191
196
|
- `exact`: `true` when `private` is the exact answer, `false` when it is a
|
|
192
197
|
lower bound.
|
|
193
|
-
- `skipped`: entries that could not be read and were left out
|
|
194
|
-
|
|
198
|
+
- `skipped`: entries that could not be read and were left out, including
|
|
199
|
+
volumes mounted inside the tree that cannot report private sizes. Above 0,
|
|
200
|
+
every size is a lower bound and `exact` is `false`. Added in 0.1.1.
|
|
195
201
|
|
|
196
202
|
Directories, symbolic links and metadata are not counted. Symbolic links are
|
|
197
203
|
never followed, and neither are Windows junctions.
|
|
@@ -226,8 +232,17 @@ distributions alike.
|
|
|
226
232
|
|
|
227
233
|
The walk uses `getattrlistbulk` and reads each file's
|
|
228
234
|
`ATTR_CMNEXT_PRIVATESIZE`, which APFS reports as the bytes the file does not
|
|
229
|
-
share with a clone.
|
|
230
|
-
exit status is 2
|
|
235
|
+
share with a clone. Only APFS reports it: on another volume format (HFS+, FAT,
|
|
236
|
+
SMB, FSKit volumes) the exit status is 2 before anything is walked. The walk
|
|
237
|
+
descends into volumes mounted inside the tree. Another APFS volume is measured
|
|
238
|
+
like the rest; any other volume is skipped as one entry and nothing in it is
|
|
239
|
+
counted.
|
|
240
|
+
|
|
241
|
+
Directories are listed on several threads, one per CPU and at most 4; past 4
|
|
242
|
+
the walk got slower on the machines measured. Each directory is opened by its
|
|
243
|
+
path when a thread takes it, so a parent directory replaced by a symbolic link
|
|
244
|
+
during the walk is followed, and the directories queued below a parent renamed
|
|
245
|
+
during the walk are left out. Linux and Windows walk on one thread.
|
|
231
246
|
|
|
232
247
|
APFS also reports a private size below the allocation for transparently
|
|
233
248
|
compressed files (decmpfs, for example files installed by some system tools),
|
|
@@ -249,8 +264,10 @@ the tree:
|
|
|
249
264
|
mapping fails, counts as entirely shared: it adds to `allocated`, nothing to
|
|
250
265
|
`private`, and sets `exact: false`.
|
|
251
266
|
- Any other filesystem (overlayfs, NFS, ZFS, bcachefs, FUSE mounts, sysfs
|
|
252
|
-
and so on)
|
|
253
|
-
|
|
267
|
+
and so on) cannot tell, because it may share blocks in ways the walk cannot
|
|
268
|
+
see. When the measured path is on one, the exit status is 2. When one is
|
|
269
|
+
mounted inside the tree, it is skipped as one entry and nothing in it is
|
|
270
|
+
counted. Container users meet this first: a Docker container's root
|
|
254
271
|
is overlayfs, while a bind-mounted host folder on ext4 works.
|
|
255
272
|
|
|
256
273
|
### Windows
|
|
@@ -298,9 +315,9 @@ runner are in [docs/benchmarks.md](docs/benchmarks.md).
|
|
|
298
315
|
|
|
299
316
|
| Machine | Filesystem | Tree | real-size | Baseline | Ratio |
|
|
300
317
|
| ------------------------------ | ---------- | ------------------------------------- | --------- | -------- | ----- |
|
|
301
|
-
| Apple M4 Pro, 14 cores | APFS | pnpm `node_modules`,
|
|
302
|
-
| Apple M4 Pro | APFS | 30,000 files hard-linked from a store |
|
|
303
|
-
| Apple M4 Pro | APFS | 117,186 small files, 7 levels |
|
|
318
|
+
| Apple M4 Pro, 14 cores | APFS | pnpm `node_modules`, 147,077 files | 482.6 ms | 864.7 ms | 0.56x |
|
|
319
|
+
| Apple M4 Pro | APFS | 30,000 files hard-linked from a store | 148.1 ms | 138.0 ms | 1.07x |
|
|
320
|
+
| Apple M4 Pro | APFS | 117,186 small files, 7 levels | 579.5 ms | 618.7 ms | 0.94x |
|
|
304
321
|
| GitHub ubuntu-latest, 4 cores | ext4 | 30,000 hard-linked files | 91.4 ms | 123.8 ms | 0.74x |
|
|
305
322
|
| GitHub ubuntu-latest | ext4 | 117,186 small files | 352.0 ms | 594.5 ms | 0.59x |
|
|
306
323
|
| GitHub ubuntu-latest | btrfs | 117,186 small files | 1.47 s | 619.8 ms | 2.37x |
|
|
@@ -318,7 +335,8 @@ on APFS, the extent map on btrfs and XFS, and the link count on Windows.
|
|
|
318
335
|
the total can be lower than what deleting both would free.
|
|
319
336
|
- The walks stop at 256 nested directories; a deeper directory is skipped and
|
|
320
337
|
counted in `skipped`.
|
|
321
|
-
- Files changed during the walk may be counted in either state.
|
|
338
|
+
- Files changed during the walk may be counted in either state. On macOS a
|
|
339
|
+
parent directory replaced by a symbolic link during the walk is followed.
|
|
322
340
|
- The plain output's sizes are rounded; use `--json` for bytes.
|
|
323
341
|
- On Linux, filesystems other than ext2/3/4, tmpfs, btrfs and XFS exit with
|
|
324
342
|
status 2 even where an answer could be given, for example ZFS without
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/skill/SKILL.md
CHANGED
|
@@ -24,7 +24,7 @@ Fields:
|
|
|
24
24
|
|
|
25
25
|
Exit status 1 with a result on stdout means some entries were skipped: stderr names each one with its reason (the first ten, then a count). Still use the result: report `private` as "at least", give the number of entries that could not be read and the paths stderr names, and suggest rerunning with the needed permissions if the user wants the full figure. Exit status 1 with nothing on stdout is a usage error or a path that cannot be read at all, with the reason on stderr.
|
|
26
26
|
|
|
27
|
-
Exit status 2 means the filesystem cannot report this (for example NFS, overlayfs, a network share, or a non-APFS volume on macOS). Then say real-size cannot tell on this filesystem, fall back to `du -sh`, and present that number as an upper bound.
|
|
27
|
+
Exit status 2 means the filesystem the path is on cannot report this (for example NFS, overlayfs, a network share, or a non-APFS volume on macOS). Then say real-size cannot tell on this filesystem, fall back to `du -sh`, and present that number as an upper bound. A volume like that mounted inside the folder does not cause exit 2: it is one of the skipped entries of exit status 1, named on stderr as "another filesystem that cannot report private size", and nothing in it is counted.
|
|
28
28
|
|
|
29
29
|
Entries deleted while the walk runs are left out without a message; they free nothing.
|
|
30
30
|
|