@photostructure/fs-metadata 1.0.1 → 1.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/CHANGELOG.md +44 -0
- package/CLAUDE.md +13 -0
- package/binding.gyp +1 -0
- package/claude.sh +29 -5
- package/dist/index.cjs +237 -129
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +55 -3
- package/dist/index.d.mts +55 -3
- package/dist/index.d.ts +55 -3
- package/dist/index.mjs +236 -130
- package/dist/index.mjs.map +1 -1
- package/doc/SECURITY_AUDIT_2025.md +1 -1
- package/doc/SECURITY_AUDIT_2026.md +361 -0
- package/doc/TPP-GUIDE.md +144 -0
- package/doc/system-volume-detection.md +268 -0
- package/package.json +12 -12
- package/prebuilds/darwin-arm64/@photostructure+fs-metadata.glibc.node +0 -0
- package/prebuilds/darwin-x64/@photostructure+fs-metadata.glibc.node +0 -0
- package/prebuilds/linux-arm64/@photostructure+fs-metadata.glibc.node +0 -0
- package/prebuilds/linux-arm64/@photostructure+fs-metadata.musl.node +0 -0
- package/prebuilds/linux-x64/@photostructure+fs-metadata.glibc.node +0 -0
- package/prebuilds/linux-x64/@photostructure+fs-metadata.musl.node +0 -0
- package/prebuilds/win32-arm64/@photostructure+fs-metadata.glibc.node +0 -0
- package/prebuilds/win32-x64/@photostructure+fs-metadata.glibc.node +0 -0
- package/src/binding.cpp +11 -0
- package/src/common/volume_metadata.h +10 -3
- package/src/common/volume_mount_points.h +7 -1
- package/src/darwin/da_mutex.h +23 -0
- package/src/darwin/get_mount_point.cpp +96 -0
- package/src/darwin/get_mount_point.h +13 -0
- package/src/darwin/raii_utils.h +39 -0
- package/src/darwin/system_volume.h +156 -0
- package/src/darwin/volume_metadata.cpp +18 -2
- package/src/darwin/volume_mount_points.cpp +46 -14
- package/src/index.ts +49 -0
- package/src/linux/mtab.ts +6 -0
- package/src/mount_point_for_path.ts +54 -0
- package/src/options.ts +7 -17
- package/src/path.ts +16 -1
- package/src/system_volume.ts +5 -9
- package/src/test-utils/assert.ts +4 -0
- package/src/types/mount_point.ts +28 -1
- package/src/types/native_bindings.ts +7 -0
- package/src/volume_metadata.ts +117 -2
- package/src/windows/system_volume.h +21 -16
- package/src/windows/volume_metadata.cpp +13 -7
- package/src/windows/volume_mount_points.cpp +11 -7
package/dist/index.d.cts
CHANGED
|
@@ -88,11 +88,36 @@ interface MountPoint {
|
|
|
88
88
|
* Indicates if this volume is primarily for system use (e.g., swap, snap
|
|
89
89
|
* loopbacks, EFI boot, or only system directories).
|
|
90
90
|
*
|
|
91
|
-
*
|
|
91
|
+
* On macOS, the sealed APFS system snapshot at `/` is detected natively via
|
|
92
|
+
* `MNT_SNAPSHOT`; other infrastructure volumes under `/System/Volumes/*` are
|
|
93
|
+
* detected via APFS volume roles (IOKit). Note that `/System/Volumes/Data`
|
|
94
|
+
* is **not** a system volume — it holds all user data, accessed via firmlinks.
|
|
92
95
|
*
|
|
93
96
|
* @see {@link Options.systemPathPatterns} and {@link Options.systemFsTypes}
|
|
94
97
|
*/
|
|
95
98
|
isSystemVolume?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* The APFS volume role, if available. Only present on macOS for APFS volumes.
|
|
101
|
+
*
|
|
102
|
+
* Common roles: `"System"`, `"Data"`, `"VM"`, `"Preboot"`, `"Recovery"`,
|
|
103
|
+
* `"Update"`, `"Hardware"`, `"xART"`, `"Prelogin"`, `"Backup"`.
|
|
104
|
+
*
|
|
105
|
+
* Used for system volume detection: volumes with a non-`"Data"` role and
|
|
106
|
+
* `MNT_DONTBROWSE` are classified as system volumes.
|
|
107
|
+
*
|
|
108
|
+
* @see https://eclecticlight.co/2024/11/21/how-do-apfs-volume-roles-work/
|
|
109
|
+
*/
|
|
110
|
+
volumeRole?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Whether the volume is mounted read-only.
|
|
113
|
+
*
|
|
114
|
+
* Examples of read-only volumes include the macOS APFS system snapshot at
|
|
115
|
+
* `/`, mounted ISO images, and write-protected media.
|
|
116
|
+
*
|
|
117
|
+
* Note that the macOS root volume (`/`) UUID changes on every OS update, so
|
|
118
|
+
* consumers should avoid using it for persistent identification.
|
|
119
|
+
*/
|
|
120
|
+
isReadOnly?: boolean;
|
|
96
121
|
/**
|
|
97
122
|
* If there are non-critical errors while extracting metadata, those errors
|
|
98
123
|
* may be added to this field.
|
|
@@ -262,7 +287,7 @@ declare function getTimeoutMsDefault(): number;
|
|
|
262
287
|
/**
|
|
263
288
|
* System paths and globs that indicate system volumes
|
|
264
289
|
*/
|
|
265
|
-
declare const SystemPathPatternsDefault: readonly ["/boot", "/boot/efi", "/dev", "/dev/**", "/proc/**", "/run", "/run/credentials/**", "/run/flatpak/**", "/run/lock", "/run/snapd/**", "/run/user/*/doc", "/run/user/*/gvfs", "/snap/**", "/sys/**", "/tmp", "/var/tmp", "**/#snapshot", "/run/docker/**", "/var/lib/docker/**", "/run/containerd/**", "/var/lib/containerd/**", "/run/containers/**", "/var/lib/containers/**", "/var/lib/kubelet/**", "/var/lib/lxc/**", "/var/lib/lxd/**", "/mnt/wslg/distro", "/mnt/wslg/doc", "/mnt/wslg/versions.txt", "/usr/lib/wsl/drivers", "/private/var/vm"
|
|
290
|
+
declare const SystemPathPatternsDefault: readonly ["/boot", "/boot/efi", "/dev", "/dev/**", "/proc/**", "/run", "/run/credentials/**", "/run/flatpak/**", "/run/lock", "/run/snapd/**", "/run/user/*/doc", "/run/user/*/gvfs", "/snap/**", "/sys/**", "/tmp", "/var/tmp", "**/#snapshot", "/run/docker/**", "/var/lib/docker/**", "/run/containerd/**", "/var/lib/containerd/**", "/run/containers/**", "/var/lib/containers/**", "/var/lib/kubelet/**", "/var/lib/lxc/**", "/var/lib/lxd/**", "/mnt/wslg/distro", "/mnt/wslg/doc", "/mnt/wslg/versions.txt", "/usr/lib/wsl/drivers", "/private/var/vm"];
|
|
266
291
|
/**
|
|
267
292
|
* Filesystem types that indicate system/virtual volumes.
|
|
268
293
|
*
|
|
@@ -332,6 +357,33 @@ declare function getVolumeMountPoints(opts?: Partial<GetVolumeMountPointOptions>
|
|
|
332
357
|
* @param opts Optional filesystem operation settings
|
|
333
358
|
*/
|
|
334
359
|
declare function getVolumeMetadata(mountPoint: string, opts?: Partial<Pick<Options, "timeoutMs">>): Promise<VolumeMetadata>;
|
|
360
|
+
/**
|
|
361
|
+
* Get metadata for the volume that contains the given file or directory path.
|
|
362
|
+
*
|
|
363
|
+
* Unlike {@link getVolumeMetadata}, this accepts any path — not just mount
|
|
364
|
+
* points. Symlinks are resolved, and macOS APFS firmlinks (e.g. `/Users` →
|
|
365
|
+
* `/System/Volumes/Data`) are handled correctly, mirroring what `df` does.
|
|
366
|
+
*
|
|
367
|
+
* @param pathname Path to any file or directory
|
|
368
|
+
* @param opts Optional filesystem operation settings
|
|
369
|
+
*/
|
|
370
|
+
declare function getVolumeMetadataForPath(pathname: string, opts?: Partial<Pick<Options, "timeoutMs" | "linuxMountTablePaths">>): Promise<VolumeMetadata>;
|
|
371
|
+
/**
|
|
372
|
+
* Get the mount point path for an arbitrary file or directory path.
|
|
373
|
+
*
|
|
374
|
+
* This is a lightweight alternative to {@link getVolumeMetadataForPath} when
|
|
375
|
+
* you only need the mount point string. On macOS it uses a single fstatfs()
|
|
376
|
+
* call (no DiskArbitration, IOKit, or space calculations). On Linux/Windows
|
|
377
|
+
* it uses device ID matching against the mount table.
|
|
378
|
+
*
|
|
379
|
+
* Symlinks are resolved, and macOS APFS firmlinks (e.g. `/Users` →
|
|
380
|
+
* `/System/Volumes/Data`) are handled correctly.
|
|
381
|
+
*
|
|
382
|
+
* @param pathname Path to any file or directory
|
|
383
|
+
* @param opts Optional settings (timeoutMs, linuxMountTablePaths)
|
|
384
|
+
* @returns The mount point path (e.g., "/", "/System/Volumes/Data", "C:\\")
|
|
385
|
+
*/
|
|
386
|
+
declare function getMountPointForPath(pathname: string, opts?: Partial<Pick<Options, "timeoutMs" | "linuxMountTablePaths">>): Promise<string>;
|
|
335
387
|
/**
|
|
336
388
|
* Retrieves metadata for all mounted volumes with optional filtering and
|
|
337
389
|
* concurrency control.
|
|
@@ -393,4 +445,4 @@ declare function getHiddenMetadata(pathname: string): Promise<HiddenMetadata>;
|
|
|
393
445
|
*/
|
|
394
446
|
declare function setHidden(pathname: string, hidden: boolean, method?: HideMethod): Promise<SetHiddenResult>;
|
|
395
447
|
|
|
396
|
-
export { type GetVolumeMountPointOptions, type HiddenMetadata, type HideMethod, IncludeSystemVolumesDefault, LinuxMountTablePathsDefault, type MountPoint, NetworkFsTypesDefault, type Options, OptionsDefault, type SetHiddenResult, SkipNetworkVolumesDefault, type StringEnum, type StringEnumKeys, type StringEnumType, SystemFsTypesDefault, SystemPathPatternsDefault, type SystemVolumeConfig, type VolumeHealthStatus, VolumeHealthStatuses, type VolumeMetadata, getAllVolumeMetadata, getHiddenMetadata, getTimeoutMsDefault, getVolumeMetadata, getVolumeMountPoints, isHidden, isHiddenRecursive, optionsWithDefaults, setHidden };
|
|
448
|
+
export { type GetVolumeMountPointOptions, type HiddenMetadata, type HideMethod, IncludeSystemVolumesDefault, LinuxMountTablePathsDefault, type MountPoint, NetworkFsTypesDefault, type Options, OptionsDefault, type SetHiddenResult, SkipNetworkVolumesDefault, type StringEnum, type StringEnumKeys, type StringEnumType, SystemFsTypesDefault, SystemPathPatternsDefault, type SystemVolumeConfig, type VolumeHealthStatus, VolumeHealthStatuses, type VolumeMetadata, getAllVolumeMetadata, getHiddenMetadata, getMountPointForPath, getTimeoutMsDefault, getVolumeMetadata, getVolumeMetadataForPath, getVolumeMountPoints, isHidden, isHiddenRecursive, optionsWithDefaults, setHidden };
|
package/dist/index.d.mts
CHANGED
|
@@ -88,11 +88,36 @@ interface MountPoint {
|
|
|
88
88
|
* Indicates if this volume is primarily for system use (e.g., swap, snap
|
|
89
89
|
* loopbacks, EFI boot, or only system directories).
|
|
90
90
|
*
|
|
91
|
-
*
|
|
91
|
+
* On macOS, the sealed APFS system snapshot at `/` is detected natively via
|
|
92
|
+
* `MNT_SNAPSHOT`; other infrastructure volumes under `/System/Volumes/*` are
|
|
93
|
+
* detected via APFS volume roles (IOKit). Note that `/System/Volumes/Data`
|
|
94
|
+
* is **not** a system volume — it holds all user data, accessed via firmlinks.
|
|
92
95
|
*
|
|
93
96
|
* @see {@link Options.systemPathPatterns} and {@link Options.systemFsTypes}
|
|
94
97
|
*/
|
|
95
98
|
isSystemVolume?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* The APFS volume role, if available. Only present on macOS for APFS volumes.
|
|
101
|
+
*
|
|
102
|
+
* Common roles: `"System"`, `"Data"`, `"VM"`, `"Preboot"`, `"Recovery"`,
|
|
103
|
+
* `"Update"`, `"Hardware"`, `"xART"`, `"Prelogin"`, `"Backup"`.
|
|
104
|
+
*
|
|
105
|
+
* Used for system volume detection: volumes with a non-`"Data"` role and
|
|
106
|
+
* `MNT_DONTBROWSE` are classified as system volumes.
|
|
107
|
+
*
|
|
108
|
+
* @see https://eclecticlight.co/2024/11/21/how-do-apfs-volume-roles-work/
|
|
109
|
+
*/
|
|
110
|
+
volumeRole?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Whether the volume is mounted read-only.
|
|
113
|
+
*
|
|
114
|
+
* Examples of read-only volumes include the macOS APFS system snapshot at
|
|
115
|
+
* `/`, mounted ISO images, and write-protected media.
|
|
116
|
+
*
|
|
117
|
+
* Note that the macOS root volume (`/`) UUID changes on every OS update, so
|
|
118
|
+
* consumers should avoid using it for persistent identification.
|
|
119
|
+
*/
|
|
120
|
+
isReadOnly?: boolean;
|
|
96
121
|
/**
|
|
97
122
|
* If there are non-critical errors while extracting metadata, those errors
|
|
98
123
|
* may be added to this field.
|
|
@@ -262,7 +287,7 @@ declare function getTimeoutMsDefault(): number;
|
|
|
262
287
|
/**
|
|
263
288
|
* System paths and globs that indicate system volumes
|
|
264
289
|
*/
|
|
265
|
-
declare const SystemPathPatternsDefault: readonly ["/boot", "/boot/efi", "/dev", "/dev/**", "/proc/**", "/run", "/run/credentials/**", "/run/flatpak/**", "/run/lock", "/run/snapd/**", "/run/user/*/doc", "/run/user/*/gvfs", "/snap/**", "/sys/**", "/tmp", "/var/tmp", "**/#snapshot", "/run/docker/**", "/var/lib/docker/**", "/run/containerd/**", "/var/lib/containerd/**", "/run/containers/**", "/var/lib/containers/**", "/var/lib/kubelet/**", "/var/lib/lxc/**", "/var/lib/lxd/**", "/mnt/wslg/distro", "/mnt/wslg/doc", "/mnt/wslg/versions.txt", "/usr/lib/wsl/drivers", "/private/var/vm"
|
|
290
|
+
declare const SystemPathPatternsDefault: readonly ["/boot", "/boot/efi", "/dev", "/dev/**", "/proc/**", "/run", "/run/credentials/**", "/run/flatpak/**", "/run/lock", "/run/snapd/**", "/run/user/*/doc", "/run/user/*/gvfs", "/snap/**", "/sys/**", "/tmp", "/var/tmp", "**/#snapshot", "/run/docker/**", "/var/lib/docker/**", "/run/containerd/**", "/var/lib/containerd/**", "/run/containers/**", "/var/lib/containers/**", "/var/lib/kubelet/**", "/var/lib/lxc/**", "/var/lib/lxd/**", "/mnt/wslg/distro", "/mnt/wslg/doc", "/mnt/wslg/versions.txt", "/usr/lib/wsl/drivers", "/private/var/vm"];
|
|
266
291
|
/**
|
|
267
292
|
* Filesystem types that indicate system/virtual volumes.
|
|
268
293
|
*
|
|
@@ -332,6 +357,33 @@ declare function getVolumeMountPoints(opts?: Partial<GetVolumeMountPointOptions>
|
|
|
332
357
|
* @param opts Optional filesystem operation settings
|
|
333
358
|
*/
|
|
334
359
|
declare function getVolumeMetadata(mountPoint: string, opts?: Partial<Pick<Options, "timeoutMs">>): Promise<VolumeMetadata>;
|
|
360
|
+
/**
|
|
361
|
+
* Get metadata for the volume that contains the given file or directory path.
|
|
362
|
+
*
|
|
363
|
+
* Unlike {@link getVolumeMetadata}, this accepts any path — not just mount
|
|
364
|
+
* points. Symlinks are resolved, and macOS APFS firmlinks (e.g. `/Users` →
|
|
365
|
+
* `/System/Volumes/Data`) are handled correctly, mirroring what `df` does.
|
|
366
|
+
*
|
|
367
|
+
* @param pathname Path to any file or directory
|
|
368
|
+
* @param opts Optional filesystem operation settings
|
|
369
|
+
*/
|
|
370
|
+
declare function getVolumeMetadataForPath(pathname: string, opts?: Partial<Pick<Options, "timeoutMs" | "linuxMountTablePaths">>): Promise<VolumeMetadata>;
|
|
371
|
+
/**
|
|
372
|
+
* Get the mount point path for an arbitrary file or directory path.
|
|
373
|
+
*
|
|
374
|
+
* This is a lightweight alternative to {@link getVolumeMetadataForPath} when
|
|
375
|
+
* you only need the mount point string. On macOS it uses a single fstatfs()
|
|
376
|
+
* call (no DiskArbitration, IOKit, or space calculations). On Linux/Windows
|
|
377
|
+
* it uses device ID matching against the mount table.
|
|
378
|
+
*
|
|
379
|
+
* Symlinks are resolved, and macOS APFS firmlinks (e.g. `/Users` →
|
|
380
|
+
* `/System/Volumes/Data`) are handled correctly.
|
|
381
|
+
*
|
|
382
|
+
* @param pathname Path to any file or directory
|
|
383
|
+
* @param opts Optional settings (timeoutMs, linuxMountTablePaths)
|
|
384
|
+
* @returns The mount point path (e.g., "/", "/System/Volumes/Data", "C:\\")
|
|
385
|
+
*/
|
|
386
|
+
declare function getMountPointForPath(pathname: string, opts?: Partial<Pick<Options, "timeoutMs" | "linuxMountTablePaths">>): Promise<string>;
|
|
335
387
|
/**
|
|
336
388
|
* Retrieves metadata for all mounted volumes with optional filtering and
|
|
337
389
|
* concurrency control.
|
|
@@ -393,4 +445,4 @@ declare function getHiddenMetadata(pathname: string): Promise<HiddenMetadata>;
|
|
|
393
445
|
*/
|
|
394
446
|
declare function setHidden(pathname: string, hidden: boolean, method?: HideMethod): Promise<SetHiddenResult>;
|
|
395
447
|
|
|
396
|
-
export { type GetVolumeMountPointOptions, type HiddenMetadata, type HideMethod, IncludeSystemVolumesDefault, LinuxMountTablePathsDefault, type MountPoint, NetworkFsTypesDefault, type Options, OptionsDefault, type SetHiddenResult, SkipNetworkVolumesDefault, type StringEnum, type StringEnumKeys, type StringEnumType, SystemFsTypesDefault, SystemPathPatternsDefault, type SystemVolumeConfig, type VolumeHealthStatus, VolumeHealthStatuses, type VolumeMetadata, getAllVolumeMetadata, getHiddenMetadata, getTimeoutMsDefault, getVolumeMetadata, getVolumeMountPoints, isHidden, isHiddenRecursive, optionsWithDefaults, setHidden };
|
|
448
|
+
export { type GetVolumeMountPointOptions, type HiddenMetadata, type HideMethod, IncludeSystemVolumesDefault, LinuxMountTablePathsDefault, type MountPoint, NetworkFsTypesDefault, type Options, OptionsDefault, type SetHiddenResult, SkipNetworkVolumesDefault, type StringEnum, type StringEnumKeys, type StringEnumType, SystemFsTypesDefault, SystemPathPatternsDefault, type SystemVolumeConfig, type VolumeHealthStatus, VolumeHealthStatuses, type VolumeMetadata, getAllVolumeMetadata, getHiddenMetadata, getMountPointForPath, getTimeoutMsDefault, getVolumeMetadata, getVolumeMetadataForPath, getVolumeMountPoints, isHidden, isHiddenRecursive, optionsWithDefaults, setHidden };
|
package/dist/index.d.ts
CHANGED
|
@@ -88,11 +88,36 @@ interface MountPoint {
|
|
|
88
88
|
* Indicates if this volume is primarily for system use (e.g., swap, snap
|
|
89
89
|
* loopbacks, EFI boot, or only system directories).
|
|
90
90
|
*
|
|
91
|
-
*
|
|
91
|
+
* On macOS, the sealed APFS system snapshot at `/` is detected natively via
|
|
92
|
+
* `MNT_SNAPSHOT`; other infrastructure volumes under `/System/Volumes/*` are
|
|
93
|
+
* detected via APFS volume roles (IOKit). Note that `/System/Volumes/Data`
|
|
94
|
+
* is **not** a system volume — it holds all user data, accessed via firmlinks.
|
|
92
95
|
*
|
|
93
96
|
* @see {@link Options.systemPathPatterns} and {@link Options.systemFsTypes}
|
|
94
97
|
*/
|
|
95
98
|
isSystemVolume?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* The APFS volume role, if available. Only present on macOS for APFS volumes.
|
|
101
|
+
*
|
|
102
|
+
* Common roles: `"System"`, `"Data"`, `"VM"`, `"Preboot"`, `"Recovery"`,
|
|
103
|
+
* `"Update"`, `"Hardware"`, `"xART"`, `"Prelogin"`, `"Backup"`.
|
|
104
|
+
*
|
|
105
|
+
* Used for system volume detection: volumes with a non-`"Data"` role and
|
|
106
|
+
* `MNT_DONTBROWSE` are classified as system volumes.
|
|
107
|
+
*
|
|
108
|
+
* @see https://eclecticlight.co/2024/11/21/how-do-apfs-volume-roles-work/
|
|
109
|
+
*/
|
|
110
|
+
volumeRole?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Whether the volume is mounted read-only.
|
|
113
|
+
*
|
|
114
|
+
* Examples of read-only volumes include the macOS APFS system snapshot at
|
|
115
|
+
* `/`, mounted ISO images, and write-protected media.
|
|
116
|
+
*
|
|
117
|
+
* Note that the macOS root volume (`/`) UUID changes on every OS update, so
|
|
118
|
+
* consumers should avoid using it for persistent identification.
|
|
119
|
+
*/
|
|
120
|
+
isReadOnly?: boolean;
|
|
96
121
|
/**
|
|
97
122
|
* If there are non-critical errors while extracting metadata, those errors
|
|
98
123
|
* may be added to this field.
|
|
@@ -262,7 +287,7 @@ declare function getTimeoutMsDefault(): number;
|
|
|
262
287
|
/**
|
|
263
288
|
* System paths and globs that indicate system volumes
|
|
264
289
|
*/
|
|
265
|
-
declare const SystemPathPatternsDefault: readonly ["/boot", "/boot/efi", "/dev", "/dev/**", "/proc/**", "/run", "/run/credentials/**", "/run/flatpak/**", "/run/lock", "/run/snapd/**", "/run/user/*/doc", "/run/user/*/gvfs", "/snap/**", "/sys/**", "/tmp", "/var/tmp", "**/#snapshot", "/run/docker/**", "/var/lib/docker/**", "/run/containerd/**", "/var/lib/containerd/**", "/run/containers/**", "/var/lib/containers/**", "/var/lib/kubelet/**", "/var/lib/lxc/**", "/var/lib/lxd/**", "/mnt/wslg/distro", "/mnt/wslg/doc", "/mnt/wslg/versions.txt", "/usr/lib/wsl/drivers", "/private/var/vm"
|
|
290
|
+
declare const SystemPathPatternsDefault: readonly ["/boot", "/boot/efi", "/dev", "/dev/**", "/proc/**", "/run", "/run/credentials/**", "/run/flatpak/**", "/run/lock", "/run/snapd/**", "/run/user/*/doc", "/run/user/*/gvfs", "/snap/**", "/sys/**", "/tmp", "/var/tmp", "**/#snapshot", "/run/docker/**", "/var/lib/docker/**", "/run/containerd/**", "/var/lib/containerd/**", "/run/containers/**", "/var/lib/containers/**", "/var/lib/kubelet/**", "/var/lib/lxc/**", "/var/lib/lxd/**", "/mnt/wslg/distro", "/mnt/wslg/doc", "/mnt/wslg/versions.txt", "/usr/lib/wsl/drivers", "/private/var/vm"];
|
|
266
291
|
/**
|
|
267
292
|
* Filesystem types that indicate system/virtual volumes.
|
|
268
293
|
*
|
|
@@ -332,6 +357,33 @@ declare function getVolumeMountPoints(opts?: Partial<GetVolumeMountPointOptions>
|
|
|
332
357
|
* @param opts Optional filesystem operation settings
|
|
333
358
|
*/
|
|
334
359
|
declare function getVolumeMetadata(mountPoint: string, opts?: Partial<Pick<Options, "timeoutMs">>): Promise<VolumeMetadata>;
|
|
360
|
+
/**
|
|
361
|
+
* Get metadata for the volume that contains the given file or directory path.
|
|
362
|
+
*
|
|
363
|
+
* Unlike {@link getVolumeMetadata}, this accepts any path — not just mount
|
|
364
|
+
* points. Symlinks are resolved, and macOS APFS firmlinks (e.g. `/Users` →
|
|
365
|
+
* `/System/Volumes/Data`) are handled correctly, mirroring what `df` does.
|
|
366
|
+
*
|
|
367
|
+
* @param pathname Path to any file or directory
|
|
368
|
+
* @param opts Optional filesystem operation settings
|
|
369
|
+
*/
|
|
370
|
+
declare function getVolumeMetadataForPath(pathname: string, opts?: Partial<Pick<Options, "timeoutMs" | "linuxMountTablePaths">>): Promise<VolumeMetadata>;
|
|
371
|
+
/**
|
|
372
|
+
* Get the mount point path for an arbitrary file or directory path.
|
|
373
|
+
*
|
|
374
|
+
* This is a lightweight alternative to {@link getVolumeMetadataForPath} when
|
|
375
|
+
* you only need the mount point string. On macOS it uses a single fstatfs()
|
|
376
|
+
* call (no DiskArbitration, IOKit, or space calculations). On Linux/Windows
|
|
377
|
+
* it uses device ID matching against the mount table.
|
|
378
|
+
*
|
|
379
|
+
* Symlinks are resolved, and macOS APFS firmlinks (e.g. `/Users` →
|
|
380
|
+
* `/System/Volumes/Data`) are handled correctly.
|
|
381
|
+
*
|
|
382
|
+
* @param pathname Path to any file or directory
|
|
383
|
+
* @param opts Optional settings (timeoutMs, linuxMountTablePaths)
|
|
384
|
+
* @returns The mount point path (e.g., "/", "/System/Volumes/Data", "C:\\")
|
|
385
|
+
*/
|
|
386
|
+
declare function getMountPointForPath(pathname: string, opts?: Partial<Pick<Options, "timeoutMs" | "linuxMountTablePaths">>): Promise<string>;
|
|
335
387
|
/**
|
|
336
388
|
* Retrieves metadata for all mounted volumes with optional filtering and
|
|
337
389
|
* concurrency control.
|
|
@@ -393,4 +445,4 @@ declare function getHiddenMetadata(pathname: string): Promise<HiddenMetadata>;
|
|
|
393
445
|
*/
|
|
394
446
|
declare function setHidden(pathname: string, hidden: boolean, method?: HideMethod): Promise<SetHiddenResult>;
|
|
395
447
|
|
|
396
|
-
export { type GetVolumeMountPointOptions, type HiddenMetadata, type HideMethod, IncludeSystemVolumesDefault, LinuxMountTablePathsDefault, type MountPoint, NetworkFsTypesDefault, type Options, OptionsDefault, type SetHiddenResult, SkipNetworkVolumesDefault, type StringEnum, type StringEnumKeys, type StringEnumType, SystemFsTypesDefault, SystemPathPatternsDefault, type SystemVolumeConfig, type VolumeHealthStatus, VolumeHealthStatuses, type VolumeMetadata, getAllVolumeMetadata, getHiddenMetadata, getTimeoutMsDefault, getVolumeMetadata, getVolumeMountPoints, isHidden, isHiddenRecursive, optionsWithDefaults, setHidden };
|
|
448
|
+
export { type GetVolumeMountPointOptions, type HiddenMetadata, type HideMethod, IncludeSystemVolumesDefault, LinuxMountTablePathsDefault, type MountPoint, NetworkFsTypesDefault, type Options, OptionsDefault, type SetHiddenResult, SkipNetworkVolumesDefault, type StringEnum, type StringEnumKeys, type StringEnumType, SystemFsTypesDefault, SystemPathPatternsDefault, type SystemVolumeConfig, type VolumeHealthStatus, VolumeHealthStatuses, type VolumeMetadata, getAllVolumeMetadata, getHiddenMetadata, getMountPointForPath, getTimeoutMsDefault, getVolumeMetadata, getVolumeMetadataForPath, getVolumeMountPoints, isHidden, isHiddenRecursive, optionsWithDefaults, setHidden };
|