@photostructure/fs-metadata
    Preparing search index...

    Function getMountPointForPath

    • Get the mount point path for an arbitrary file or directory path.

      This is a lightweight alternative to getVolumeMetadataForPath when you only need the mount point string. On macOS it uses a single fstatfs() call (no DiskArbitration, IOKit, or space calculations). On Linux/Windows it uses device ID matching against the mount table: mount points that are path ancestors of the target are preferred (deepest wins), and if none is an ancestor, the longest same-device mount point is returned so that bind-mounted paths still resolve to their canonical mount point. See Options.mountPoints for the implications when supplying a custom mount point array.

      Symlinks are resolved, and macOS APFS firmlinks (e.g. /Users/System/Volumes/Data) are handled correctly.

      Parameters

      • pathname: string

        Path to any file or directory

      • Optionalopts: Partial<
            Pick<
                Options,
                | "mountPoints"
                | "timeoutMs"
                | "linuxMountTablePaths"
                | "networkFsTypes"
                | "skipNetworkVolumes",
            >,
        >

        Optional settings (timeoutMs, linuxMountTablePaths, mountPoints)

      Returns Promise<string>

      The mount point path (e.g., "/", "/System/Volumes/Data", "C:\"). On Linux this may be a file when the input is itself a file bind mount.