@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.
Files changed (47) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/CLAUDE.md +13 -0
  3. package/binding.gyp +1 -0
  4. package/claude.sh +29 -5
  5. package/dist/index.cjs +237 -129
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +55 -3
  8. package/dist/index.d.mts +55 -3
  9. package/dist/index.d.ts +55 -3
  10. package/dist/index.mjs +236 -130
  11. package/dist/index.mjs.map +1 -1
  12. package/doc/SECURITY_AUDIT_2025.md +1 -1
  13. package/doc/SECURITY_AUDIT_2026.md +361 -0
  14. package/doc/TPP-GUIDE.md +144 -0
  15. package/doc/system-volume-detection.md +268 -0
  16. package/package.json +12 -12
  17. package/prebuilds/darwin-arm64/@photostructure+fs-metadata.glibc.node +0 -0
  18. package/prebuilds/darwin-x64/@photostructure+fs-metadata.glibc.node +0 -0
  19. package/prebuilds/linux-arm64/@photostructure+fs-metadata.glibc.node +0 -0
  20. package/prebuilds/linux-arm64/@photostructure+fs-metadata.musl.node +0 -0
  21. package/prebuilds/linux-x64/@photostructure+fs-metadata.glibc.node +0 -0
  22. package/prebuilds/linux-x64/@photostructure+fs-metadata.musl.node +0 -0
  23. package/prebuilds/win32-arm64/@photostructure+fs-metadata.glibc.node +0 -0
  24. package/prebuilds/win32-x64/@photostructure+fs-metadata.glibc.node +0 -0
  25. package/src/binding.cpp +11 -0
  26. package/src/common/volume_metadata.h +10 -3
  27. package/src/common/volume_mount_points.h +7 -1
  28. package/src/darwin/da_mutex.h +23 -0
  29. package/src/darwin/get_mount_point.cpp +96 -0
  30. package/src/darwin/get_mount_point.h +13 -0
  31. package/src/darwin/raii_utils.h +39 -0
  32. package/src/darwin/system_volume.h +156 -0
  33. package/src/darwin/volume_metadata.cpp +18 -2
  34. package/src/darwin/volume_mount_points.cpp +46 -14
  35. package/src/index.ts +49 -0
  36. package/src/linux/mtab.ts +6 -0
  37. package/src/mount_point_for_path.ts +54 -0
  38. package/src/options.ts +7 -17
  39. package/src/path.ts +16 -1
  40. package/src/system_volume.ts +5 -9
  41. package/src/test-utils/assert.ts +4 -0
  42. package/src/types/mount_point.ts +28 -1
  43. package/src/types/native_bindings.ts +7 -0
  44. package/src/volume_metadata.ts +117 -2
  45. package/src/windows/system_volume.h +21 -16
  46. package/src/windows/volume_metadata.cpp +13 -7
  47. 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
- * Note: This is a best-effort classification and is not 100% accurate.
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", "/System/Volumes/Hardware", "/System/Volumes/iSCPreboot", "/System/Volumes/Preboot", "/System/Volumes/Recovery", "/System/Volumes/Reserved", "/System/Volumes/Update", "/System/Volumes/VM", "/System/Volumes/xarts", "**/.DocumentRevisions-V100", "**/.fseventsd", "**/.Spotlight-V100", "**/.Trashes"];
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
- * Note: This is a best-effort classification and is not 100% accurate.
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", "/System/Volumes/Hardware", "/System/Volumes/iSCPreboot", "/System/Volumes/Preboot", "/System/Volumes/Recovery", "/System/Volumes/Reserved", "/System/Volumes/Update", "/System/Volumes/VM", "/System/Volumes/xarts", "**/.DocumentRevisions-V100", "**/.fseventsd", "**/.Spotlight-V100", "**/.Trashes"];
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
- * Note: This is a best-effort classification and is not 100% accurate.
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", "/System/Volumes/Hardware", "/System/Volumes/iSCPreboot", "/System/Volumes/Preboot", "/System/Volumes/Recovery", "/System/Volumes/Reserved", "/System/Volumes/Update", "/System/Volumes/VM", "/System/Volumes/xarts", "**/.DocumentRevisions-V100", "**/.fseventsd", "**/.Spotlight-V100", "**/.Trashes"];
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 };