/** Default delay between subscription polls: one minute. */ declare const PollIntervalMsDefault: number; interface PollingWatcherOptions { /** Milliseconds between one completed poll and the start of the next. */ pollIntervalMs?: number; /** Whether the pending poll timer keeps the Node.js event loop alive. */ persistent?: boolean; /** Closes the watcher when aborted. */ signal?: AbortSignal; } /** Public lifecycle and events shared by polling subscriptions. */ interface PollingSubscription { readonly ready: Promise; readonly lastError: Error | undefined; readonly closed: boolean; close(): void; ref(): this; unref(): this; hasRef(): boolean; on(event: "change", listener: (change: TChange) => void): this; on(event: "error", listener: (error: Error) => void): this; once(event: "change", listener: (change: TChange) => void): this; once(event: "error", listener: (error: Error) => void): this; off(event: "change", listener: (change: TChange) => void): this; off(event: "error", listener: (error: Error) => void): this; } type AvailableSpaceState = "aboveMinimum" | "belowMinimum"; interface AvailableSpaceStatus { path: string; availableBytes: number; state: AvailableSpaceState; } interface AvailableSpaceChange { previous: AvailableSpaceStatus; current: AvailableSpaceStatus; } interface WatchAvailableSpaceOptions extends PollingWatcherOptions { /** Threshold whose crossings should be reported. */ minimumAvailableBytes: number; /** Extra available bytes required before recovering from below-minimum. */ hysteresisBytes?: number; /** * Caller-visible budget for each capacity probe; 0 disables it. Defaults to * {@link getTimeoutMsDefault}. */ timeoutMs?: number; } type AvailableSpaceChangeListener = (change: AvailableSpaceChange) => void; type AvailableSpaceWatcher = PollingSubscription; type StringEnumType = { [K in T]: K; }; type StringEnum = StringEnumType & { values: T[]; size: number; get(s: string | undefined): T | undefined; }; type StringEnumKeys = Type extends StringEnum ? X : never; /** * Represents the detailed state of a file or directory's hidden attribute */ interface HiddenMetadata { /** * Whether the item is considered hidden by any method */ hidden: boolean; /** * Whether the item has a dot prefix (POSIX-style hidden). Windows doesn't * care about dot prefixes. */ dotPrefix: boolean; /** * Whether the item has system hidden flags set, like via `chflags` on macOS * or on Windows via `GetFileAttributesW` */ systemFlag: boolean; /** * Indicates which hiding methods are supported on the current platform */ supported: { /** * Whether dot prefix hiding is supported on the current operating system */ dotPrefix: boolean; /** * Whether system flag hiding is supported */ systemFlag: boolean; }; } /** * Accessibility statuses returned while enumerating volumes. * * - `healthy`: Volume is "OK": accessible and functioning normally * - `timeout`: Volume could not be accessed before the specified timeout. It * may be inaccessible or disconnected. * - `inaccessible`: Volume exists but can't be accessed (permissions/locks) * - `disconnected`: Network volume that's offline * - `unknown`: Status can't be determined */ declare const VolumeHealthStatuses: StringEnum<"healthy" | "timeout" | "inaccessible" | "disconnected" | "unknown">; type VolumeHealthStatus = StringEnumKeys; /** * A mount point is a location in the file system where a volume is mounted. * * @see https://en.wikipedia.org/wiki/Mount_(computing) */ interface MountPoint { /** * Mount location (like "/" or "C:\"). Explicit Linux path queries may * return a file path when that file is itself a bind-mount target. Public * volume enumeration omits detected non-directory targets; unprobed remote * targets are retained when `skipNetworkVolumes` is true. */ mountPoint: string; /** * The type of file system on the volume, like `ext4`, `apfs`, or `ntfs`. * * Note: on Windows this may show as "ntfs" for remote filesystems, as that * is how the filesystem is presented to the OS. */ fstype?: string; /** * Lightweight accessibility status observed while enumerating the mount * point. This does not run a filesystem integrity check such as `fsck` or * `diskutil verifyVolume`. * * Linux and macOS derive this from bounded access probes. Windows additionally * maps explicit offline network errors to `disconnected`. The status may be * absent when probing is deliberately skipped, such as for an unprobed remote * mount. * * Not every value is a {@link VolumeHealthStatus}: on Linux, a non-critical * metadata error may land here instead, such as `"Blkid warning: …"` when * libblkid cannot read a volume's UUID or label. * * @see {@link VolumeHealthStatuses} for the standard values. */ status?: VolumeHealthStatus | string; /** * Indicates if this volume is primarily for system use (e.g., swap, snap * loopbacks, EFI boot, or only system directories). * * On macOS, the sealed APFS system snapshot at `/` is detected natively via * `MNT_SNAPSHOT`; other infrastructure volumes under `/System/Volumes/*` are * detected via APFS volume roles (IOKit). Note that `/System/Volumes/Data` * is **not** a system volume — it holds all user data, accessed via firmlinks. * * @see {@link Options.systemPathPatterns} and {@link Options.systemFsTypes} */ isSystemVolume?: boolean; /** * The APFS volume role, if available. Only present on macOS for APFS volumes. * * Common roles: `"System"`, `"Data"`, `"VM"`, `"Preboot"`, `"Recovery"`, * `"Update"`, `"Hardware"`, `"xART"`, `"Prelogin"`, `"Backup"`. * * Used for system volume detection: volumes with a non-`"Data"` role and * `MNT_DONTBROWSE` are classified as system volumes. * * @see https://eclecticlight.co/2024/11/21/how-do-apfs-volume-roles-work/ */ volumeRole?: string; /** * On btrfs, the subvolume path this mount exposes, taken verbatim from the * `subvol=` mount option (e.g. `/@` or `/@home`). Undefined on non-btrfs * volumes. * * Several mount points can be distinct subvolumes of one btrfs filesystem and * therefore share a single filesystem-level {@link VolumeMetadata.uuid}. * `subvol` and {@link subvolid} distinguish such siblings. Note that the * subvol path changes if the subvolume is renamed or moved; for a * rename-stable identifier prefer {@link VolumeMetadata.subvolumeUuid}. */ subvol?: string; /** * On btrfs, the numeric subvolume id from the `subvolid=` mount option (e.g. * `256`, `257`). Undefined on non-btrfs volumes. * * Stable across remount/reboot on a given filesystem, but **not** unique * across filesystems and **not** preserved by `btrfs send`/`receive`. See * {@link subvol} for context and {@link VolumeMetadata.subvolumeUuid} for a * stronger identifier. */ subvolid?: number; /** * Whether the volume is mounted read-only. * * Examples of read-only volumes include the macOS APFS system snapshot at * `/`, mounted ISO images, and write-protected media. * * Note that the macOS root volume (`/`) UUID changes on every OS update, so * consumers should avoid using it for persistent identification. */ isReadOnly?: boolean; /** * If there are non-critical errors while extracting metadata, those errors * may be added to this field. */ error?: Error | string; } /** * Configuration options for filesystem operations. * * @see {@link optionsWithDefaults} for creating an options object with default values * @see {@link OptionsDefault} for the default values */ interface Options { /** * Pre-fetched mount points to use instead of querying the system. * * When provided, functions like {@link getMountPointForPath} and * {@link getVolumeMetadataForPath} will use these mount points for device ID * matching instead of calling {@link getVolumeMountPoints} internally. This * avoids redundant system queries when resolving multiple paths. * * Obtain via `getVolumeMountPoints({ includeSystemVolumes: true })` — system * volumes must be included for device ID matching to work correctly. * On Linux that public list intentionally omits detected file mount targets. * Remote targets are not classified when `skipNetworkVolumes` is true. Omit * this option when resolving a path that may itself be a file bind mount, or * include that exact target in a custom array. * * On Linux and Windows, resolution prefers entries that are path ancestors * of the target. If this array contains no ancestor of the target path, a * same-device entry that is *not* an ancestor may be returned instead. That * fallback is intentional (it lets bind-mounted paths resolve to their * canonical mount point), but it means an incomplete or hand-picked array * can match an entry with no path relationship to the target. * * A long array is cheap: only entries that are path ancestors of the target * are `stat()`ed, and the rest are touched solely when no ancestor is on the * target's device. An unreachable entry therefore costs nothing unless the * target actually resolves through the fallback. */ mountPoints?: MountPoint[]; /** * Timeout in milliseconds for filesystem operations. * * Disable timeouts by setting this to 0. * * This bounds each single-volume operation — `getVolumeMetadata()`, * `getVolumeMetadataForPath()`, `getMountPointForPath()` — and mount point * enumeration. It is **not** one global deadline for * `getAllVolumeMetadata()`, which applies it to enumeration and to each * per-volume call separately. * * Sub-operations that must not consume a whole budget derive a smaller one * from it: the per-mount-point health probe during enumeration takes a * fraction, and the opt-in ZFS GUID queries reserve time for teardown. * Raising `timeoutMs` raises both. * * On Windows this is applied **per system call** by the native layer rather * than as one deadline around enumeration, so the health probe there keeps * the full value instead of a fraction. * * @see {@link getTimeoutMsDefault}. */ timeoutMs: number; /** * Maximum number of concurrent filesystem operations. * * Defaults to `UV_THREADPOOL_SIZE` plus a little headroom (so 7 unless the * pool was raised), capped by * {@link https://nodejs.org/api/os.html#osavailableparallelism | availableParallelism}. * Filesystem work runs on libuv's * shared, FIFO-queued thread pool rather than one thread per core, so this * limit tracks that pool: it bounds how deeply this library can queue ahead * of unrelated IO in the host application. * * Raise it for marginally faster enumeration at the cost of host-application * latency, or raise `UV_THREADPOOL_SIZE` (before any IO happens) to lift * both. */ maxConcurrency: number; /** * Mount point pathnames matching any of these glob patterns will have * {@link MountPoint.isSystemVolume} set to true. * * Matching runs on every platform. The defaults describe POSIX system paths, * which no Windows drive letter matches. * * @see {@link SystemPathPatternsDefault} for the default value */ systemPathPatterns: string[]; /** * Volumes whose filesystem type exactly equals any of these strings will * have {@link MountPoint.isSystemVolume} set to true. * * Unlike {@link systemPathPatterns}, these are compared literally: glob * patterns are **not** supported. FUSE subtypes must be spelled in full * (`"fuse.lxcfs"`, not `"fuse"`). * * Matching runs on every platform. The defaults are POSIX pseudo-filesystems, * so nothing matches a Windows volume unless you override this — note that * `["NTFS"]` would mark every NTFS drive a system volume. * * @see {@link SystemFsTypesDefault} for the default value */ systemFsTypes: string[]; /** * On Linux, use the first mount point table in this array that is readable. * * @see {@link LinuxMountTablePathsDefault} for the default values */ linuxMountTablePaths: string[]; /** * Filesystem types that indicate network/remote volumes. * * @see {@link NetworkFsTypesDefault} for the default value */ networkFsTypes: string[]; /** * Should system volumes be included in result arrays? Defaults to true on * Windows and false elsewhere. */ includeSystemVolumes: boolean; /** * Skip the detailed (potentially blocking) volume queries for network * volumes. Defaults to false. * * When enabled, remote volumes return shallow metadata derived from the * mount table or mount-point enumeration instead of probing the volume: * `size`/`used`/`available`, `label`, and `uuid` are omitted, and `remote` * is true. * * - On Linux, `getVolumeMetadata()` detects remote volumes from the mount * table (which never touches the mount point itself) and returns * `status: "unknown"` without any filesystem IO on the volume. * - On macOS and Windows, single-volume `getVolumeMetadata()` calls cannot * cheaply detect remote-ness up front, so only `getAllVolumeMetadata()` * honors this option there, using the fstype from mount-point * enumeration matched against {@link Options.networkFsTypes}. Note that * Windows drive letters mapped to network shares report the remote * server's filesystem (typically `NTFS`), so mapped drives may still be * probed. `timeoutMs` bounds each single-volume metadata call (applied per * volume by `getAllVolumeMetadata()`, not as one global deadline) and * native drive checks use adaptive Windows callback-pool capacity, but a * blocked OS request may continue in the background because cancellation is * provider-dependent. * - Path resolution ({@link getVolumeMetadataForPath}, * {@link getMountPointForPath}) skips `stat()`ing remote mount points * that are not path ancestors of the target, so a dead network mount * cannot hang lookups for unrelated local paths. */ skipNetworkVolumes: boolean; /** * On Linux ZFS volumes, query the external `zfs` and `zpool` commands for * their authoritative 64-bit GUID properties and expose them as * {@link VolumeMetadata.zfsDatasetGuid} and * {@link VolumeMetadata.zfsPoolGuid}. * * Defaults to `false`. Enabling this adds subprocess overhead and requires * the OpenZFS command-line tools. Query failures leave the optional fields * undefined without failing the metadata request. */ includeZfsGuids?: boolean; } /** * Options after defaults have been applied. * * `mountPoints` remains optional because it is caller-provided cached data, * not a defaulted setting. */ type ResolvedOptions = Options & Required>; /** * Represents remote filesystem information. */ interface RemoteInfo { /** * We can sometimes fetch a URI of the resource (like "smb://server/share" or * "file:///media/user/usb") */ uri?: string; /** * Protocol used to access the share. */ protocol?: string; /** * Does the protocol seem to be a remote filesystem? */ remote: boolean; /** * If remote, may include the username used to access the share. * * This will be undefined on NFS and other remote filesystem types that do * authentication out of band. */ remoteUser?: string; /** * If remote, the ip or hostname hosting the share (like "rusty" or "10.1.1.3") */ remoteHost?: string; /** * If remote, the name of the share (like "homes") */ remoteShare?: string; } /** * Metadata associated to a volume. * * @see https://en.wikipedia.org/wiki/Volume_(computing) */ interface VolumeMetadata extends RemoteInfo, MountPoint { /** * The name of the partition */ label?: string; /** * Total size in bytes */ size?: number; /** * Used size in bytes */ used?: number; /** * Available size in bytes */ available?: number; /** * Path to the device or service that the mountpoint is from. * * Examples include `/dev/sda1`, `nfs-server:/export`, * `//username@remoteHost/remoteShare`, or `//cifs-server/share`. * * May be undefined for remote volumes. */ mountFrom?: string; /** * The name of the mount. This may match the resolved mountPoint. */ mountName?: string; /** * UUID for the volume, like "c9b08f6e-b392-11ef-bf19-4b13bb7db4b4". * * On windows, this _may_ be the 128-bit volume UUID, but if that is not * available, like in the case of remote volumes, we fallback to the 32-bit * volume serial number, rendered in lowercase hexadecimal. * * Note that on btrfs this is the **filesystem** UUID (keyed on the block * device by libblkid), so every subvolume of one filesystem reports the same * value. Use {@link subvolumeUuid} (and/or {@link MountPoint.subvolid}) to * distinguish sibling subvolumes. */ uuid?: string; /** * On btrfs, the UUID of the individual subvolume mounted here, read from the * subvolume's root item via the `BTRFS_IOC_GET_SUBVOL_INFO` ioctl (kernel * >= 4.18, unprivileged). Rendered as a canonical lowercase hyphenated UUID. * Undefined on non-btrfs volumes, and on kernels/builds where the ioctl is * unavailable. * * Unlike {@link uuid} (the filesystem UUID, shared by all subvolumes) and * {@link MountPoint.subvolid} (stable only within one filesystem), this is * the strongest per-subvolume identifier: * * - stable across remount/reboot; * - `btrfs send`/`receive` preserves the source subvolume's UUID as the * destination's `received_uuid` (the destination itself gets a fresh UUID); * - a snapshot gets a fresh UUID and records its origin as `parent_uuid`. * * This makes it suitable for persistent per-subvolume identity where the * filesystem {@link uuid} would collide across siblings. */ subvolumeUuid?: string; /** * A quick filesystem identifier read from `statfs(2)`'s `f_fsid`, rendered as * a 16-character lowercase hex string. * * Currently populated on **ZFS**, where it is normally distinct per dataset * and stable across remount, reboot, and rename. It is not immutable: OpenZFS * may remap it to resolve an active collision between duplicated datasets. * Treat it as a current identity or fallback, not the sole durable identity. * * This is not the authoritative ZFS `guid` property. Enable * {@link Options.includeZfsGuids} to populate {@link zfsDatasetGuid} and * {@link zfsPoolGuid}. Undefined on non-ZFS filesystems. */ fsid?: string; /** * The authoritative unsigned 64-bit ZFS dataset `guid` property, rendered as * a decimal string to avoid JavaScript precision loss. The GUID does not * change during the dataset's lifetime. * * Linux ZFS only, and populated only when {@link Options.includeZfsGuids} is * true and the external `zfs` command succeeds. Kept separate from * {@link zfsPoolGuid} so consumers can choose lineage or copy-level identity * semantics. */ zfsDatasetGuid?: string; /** * The authoritative unsigned 64-bit ZFS pool `guid` property, rendered as a * decimal string to avoid JavaScript precision loss. * * Linux ZFS only, and populated only when {@link Options.includeZfsGuids} is * true and the external `zpool` command succeeds. An administrator can change * this value explicitly with `zpool reguid`. */ zfsPoolGuid?: string; } declare const HideMethods: StringEnum<"dotPrefix" | "systemFlag" | "all" | "auto">; type HideMethod = StringEnumKeys; type SetHiddenResult = { pathname: string; actions: { dotPrefix: boolean; systemFlag: boolean; }; }; /** * Get the default timeout in milliseconds for {@link Options.timeoutMs}. * * This can be overridden by setting the `FS_METADATA_TIMEOUT_MS` environment * variable to a positive integer. * * Note that this timeout may be insufficient for some devices, like spun-down * optical drives or network shares that need to spin up or reconnect. * * @returns The timeout from env var if valid, otherwise 5000ms */ declare function getTimeoutMsDefault(): number; /** * System paths and globs that indicate system volumes */ 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/**", "/var/lib/snapd/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"]; /** * Filesystem types that indicate system/virtual volumes. * * These are pseudo-filesystems that don't represent real storage devices. * See /proc/filesystems for the full list supported by the running kernel. * * Entries are matched **exactly** by `isSystemVolume()` — this list is not * glob-compiled the way {@link SystemPathPatternsDefault} is, so every fstype * (including each `fuse.` subtype) must be spelled out in full. * * @see https://www.kernel.org/doc/html/latest/filesystems/ - Linux kernel filesystem docs * @see https://man7.org/linux/man-pages/man5/proc_filesystems.5.html - /proc/filesystems */ declare const SystemFsTypesDefault: readonly ["autofs", "binfmt_misc", "bpf", "cgroup", "cgroup2", "configfs", "debugfs", "devpts", "devtmpfs", "efivarfs", "fusectl", "fuse.gvfsd-fuse", "fuse.lxcfs", "fuse.portal", "fuse.snapfuse", "fuse.squashfuse", "hugetlbfs", "mqueue", "none", "nsfs", "proc", "pstore", "ramfs", "rootfs", "rpc_pipefs", "securityfs", "squashfs", "sysfs", "tmpfs", "tracefs"]; declare const LinuxMountTablePathsDefault: readonly ["/proc/self/mounts", "/proc/mounts", "/etc/mtab"]; /** * Network/remote filesystem types. * * These filesystems require network connectivity and may have higher latency * or availability concerns. Used by {@link Options.networkFsTypes}. * * Based on systemd's fstype_is_network() and common FUSE remote filesystems. * @see https://github.com/systemd/systemd/blob/main/src/basic/mountpoint-util.c - fstype_is_network() */ declare const NetworkFsTypesDefault: readonly ["9p", "afp", "afs", "beegfs", "ceph", "cifs", "ftp", "fuse", "fuse.rclone", "fuse.s3fs", "fuse.sshfs", "gfs", "gfs2", "glusterfs", "lustre", "ncpfs", "ncp", "nfs", "nfs4", "smb", "smbfs", "sshfs", "webdav"]; /** * Should {@link getAllVolumeMetadata} include system volumes by * default? */ declare const IncludeSystemVolumesDefault: boolean; /** * Default value for {@link Options.skipNetworkVolumes}. */ declare const SkipNetworkVolumesDefault = false; /** * Default {@link Options} object. * * @see {@link optionsWithDefaults} for creating an options object with default values */ declare const OptionsDefault: ResolvedOptions; /** * Create an {@link Options} object using default values from * {@link OptionsDefault} for missing fields. */ declare function optionsWithDefaults(overrides?: Partial): T & ResolvedOptions; /** * Configuration for system volume detection * * @see {@link MountPoint.isSystemVolume} */ type SystemVolumeConfig = Pick; type GetVolumeMountPointOptions = Partial & SystemVolumeConfig>; type WatchVolumeMountPointsOptions = GetVolumeMountPointOptions & PollingWatcherOptions; interface VolumeMountChange { /** Monotonically increasing generation of emitted changes. */ generation: number; /** Mount points present in the current snapshot but not the prior one. */ added: readonly MountPoint[]; /** Last-observed records absent from the current snapshot. */ removed: readonly MountPoint[]; } type VolumeMountChangeListener = (change: VolumeMountChange) => void; type VolumeMountWatcher = PollingSubscription; /** * List all active local and remote mount points on the system. * * Linux file bind mounts are omitted after target probing; explicit path * queries still resolve and inspect them. When `skipNetworkVolumes` is true, * remote targets are not touched, so entries whose target type cannot be * determined are retained. * * Note that on Windows, `timeoutMs` will be used **per system call** and not * for the entire operation. * * @param opts Optional filesystem operation settings to override default values */ declare function getVolumeMountPoints(opts?: Partial): Promise; /** * Watch the process-visible mount-point set for additions and removals. * * This is a polling, eventually consistent state observer rather than a * lossless mount-operation log. The caller controls the delay between polls * with `pollIntervalMs`; it defaults to {@link PollIntervalMsDefault} (one * minute). A new poll starts only after the prior poll has fully settled. * `timeoutMs` bounds each caller-visible snapshot, but cannot cancel its * underlying native or filesystem work; after a timeout, another poll is not * scheduled until that raw work settles. On Linux, newly observed local paths * receive a directory probe with one quarter of that snapshot budget. * * Snapshots do not fetch capacity or accessibility status. On Linux, each * newly observed local path (including the initial set) gets one directory * probe to preserve the public directory-only mount-point behavior; remote * paths are never probed, and raw timed-out probes must settle before another * poll starts. On Windows, observation follows the current logical-drive-root * enumeration and does not include directory-mounted volume paths. Because * that shallow Windows enumeration does not query filesystem types, passing a * custom `systemFsTypes` filter throws. Windows snapshots contain only * `mountPoint` and the TypeScript-derived `isSystemVolume`; fields that require * touching the drive, including `fstype` and `isReadOnly`, are omitted. * * Existing mount points are returned by `watcher.ready`; they are not emitted * as additions. A transient later polling error is available as `lastError` * and through an `error` listener when one is registered, while the last good * snapshot is retained. */ declare function watchVolumeMountPoints(opts?: WatchVolumeMountPointsOptions, listener?: VolumeMountChangeListener): VolumeMountWatcher; /** * Watch whether the filesystem containing `pathname` has at least a requested * number of bytes available to the current caller. * * The initial predicate state is returned by `watcher.ready`. The listener is * called only when the state crosses below the minimum or recovers above the * minimum plus `hysteresisBytes`. Polling errors and timeouts never manufacture * a low-space transition, and a timed-out filesystem request must settle before * another poll is scheduled. */ declare function watchAvailableSpace(pathname: string, opts: WatchAvailableSpaceOptions, listener?: AvailableSpaceChangeListener): AvailableSpaceWatcher; /** * Get metadata for the volume at the given mount point. * * `timeoutMs` bounds the complete caller-visible operation on every platform. * It does not guarantee cancellation of a filesystem request already blocked * inside the operating system. * * @param mountPoint Must be a non-blank string. On Linux, this may be a file * that is itself a mount target. * @param opts Optional filesystem operation settings, including * {@link Options.skipNetworkVolumes} to avoid blocking on unreachable * network volumes */ declare function getVolumeMetadata(mountPoint: string, opts?: Partial>): Promise; /** * Get metadata for the volume that contains the given file or directory path. * * Unlike {@link getVolumeMetadata}, this accepts any path — not just mount * points. Symlinks are resolved, and macOS APFS firmlinks (e.g. `/Users` → * `/System/Volumes/Data`) are handled correctly, mirroring what `df` does. * * @param pathname Path to any file or directory * @param opts Optional filesystem operation settings */ declare function getVolumeMetadataForPath(pathname: string, opts?: Partial>): Promise; /** * Get the mount point path for an arbitrary file or directory path. * * This is a lightweight alternative to {@link 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 * {@link 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. * * @param pathname Path to any file or directory * @param opts Optional settings (timeoutMs, linuxMountTablePaths, mountPoints) * @returns 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. */ declare function getMountPointForPath(pathname: string, opts?: Partial>): Promise; /** * Retrieves metadata for all mounted volumes with optional filtering and * concurrency control. * * @param opts - Optional configuration object * @param opts.includeSystemVolumes - If true, includes system volumes in the * results. Defaults to true on Windows and false elsewhere. * @param opts.maxConcurrency - Maximum number of concurrent operations. * Defaults to `UV_THREADPOOL_SIZE` plus a little headroom, capped by * {@link https://nodejs.org/api/os.html#osavailableparallelism | os.availableParallelism()} * @param opts.timeoutMs - Maximum time to wait for * {@link getVolumeMountPointsImpl}, as well as **each** {@link getVolumeMetadataImpl} * to complete. Defaults to {@link getTimeoutMsDefault} * @returns Promise that resolves to an array of either VolumeMetadata objects * or error objects containing the mount point and error * @throws Never - errors are caught and returned as part of the result array */ declare function getAllVolumeMetadata(opts?: Partial & { includeSystemVolumes?: boolean; }): Promise; /** * Check if a file or directory is hidden. * * Note that `path` may be _effectively_ hidden if any of the ancestor * directories are hidden: use {@link isHiddenRecursive} to check for this. * * @param pathname Path to file or directory * @returns Promise resolving to boolean indicating hidden state */ declare function isHidden(pathname: string): Promise; /** * Check if a file or directory is hidden, or if any of its ancestor * directories are hidden. * * @param pathname Path to file or directory * @returns Promise resolving to boolean indicating hidden state */ declare function isHiddenRecursive(pathname: string): Promise; /** * Get detailed metadata about the hidden state of a file or directory. * * @param pathname Path to file or directory * @returns Promise resolving to metadata about the hidden state */ declare function getHiddenMetadata(pathname: string): Promise; /** * Set the hidden state of a file or directory * * @param pathname Path to file or directory * @param hidden - Whether the item should be hidden (true) or visible (false) * @param method Method to use for hiding the file or directory. The default * is "auto", which is "dotPrefix" on Linux and macOS, and "systemFlag" on * Windows. "all" will attempt to use all relevant methods for the current * operating system. * @returns Promise resolving the final name of the file or directory (as it * will change on POSIX systems), and the action(s) taken. * @throws {Error} If the file doesn't exist, permissions are insufficient, or * the requested method is unsupported */ declare function setHidden(pathname: string, hidden: boolean, method?: HideMethod): Promise; export { type AvailableSpaceChange, type AvailableSpaceChangeListener, type AvailableSpaceState, type AvailableSpaceStatus, type AvailableSpaceWatcher, type GetVolumeMountPointOptions, type HiddenMetadata, type HideMethod, IncludeSystemVolumesDefault, LinuxMountTablePathsDefault, type MountPoint, NetworkFsTypesDefault, type Options, OptionsDefault, PollIntervalMsDefault, type PollingSubscription, type PollingWatcherOptions, type ResolvedOptions, type SetHiddenResult, SkipNetworkVolumesDefault, type StringEnum, type StringEnumKeys, type StringEnumType, SystemFsTypesDefault, SystemPathPatternsDefault, type SystemVolumeConfig, type VolumeHealthStatus, VolumeHealthStatuses, type VolumeMetadata, type VolumeMountChange, type VolumeMountChangeListener, type VolumeMountWatcher, type WatchAvailableSpaceOptions, type WatchVolumeMountPointsOptions, getAllVolumeMetadata, getHiddenMetadata, getMountPointForPath, getTimeoutMsDefault, getVolumeMetadata, getVolumeMetadataForPath, getVolumeMountPoints, isHidden, isHiddenRecursive, optionsWithDefaults, setHidden, watchAvailableSpace, watchVolumeMountPoints };