@photostructure/fs-metadata 1.2.0 → 1.3.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/dist/index.d.cts CHANGED
@@ -132,6 +132,18 @@ interface MountPoint {
132
132
  * @see {@link OptionsDefault} for the default values
133
133
  */
134
134
  interface Options {
135
+ /**
136
+ * Pre-fetched mount points to use instead of querying the system.
137
+ *
138
+ * When provided, functions like {@link getMountPointForPath} and
139
+ * {@link getVolumeMetadataForPath} will use these mount points for device ID
140
+ * matching instead of calling {@link getVolumeMountPoints} internally. This
141
+ * avoids redundant system queries when resolving multiple paths.
142
+ *
143
+ * Obtain via `getVolumeMountPoints({ includeSystemVolumes: true })` — system
144
+ * volumes must be included for device ID matching to work correctly.
145
+ */
146
+ mountPoints?: MountPoint[];
135
147
  /**
136
148
  * Timeout in milliseconds for filesystem operations.
137
149
  *
@@ -367,7 +379,7 @@ declare function getVolumeMetadata(mountPoint: string, opts?: Partial<Pick<Optio
367
379
  * @param pathname Path to any file or directory
368
380
  * @param opts Optional filesystem operation settings
369
381
  */
370
- declare function getVolumeMetadataForPath(pathname: string, opts?: Partial<Pick<Options, "timeoutMs" | "linuxMountTablePaths">>): Promise<VolumeMetadata>;
382
+ declare function getVolumeMetadataForPath(pathname: string, opts?: Partial<Pick<Options, "timeoutMs" | "linuxMountTablePaths" | "mountPoints">>): Promise<VolumeMetadata>;
371
383
  /**
372
384
  * Get the mount point path for an arbitrary file or directory path.
373
385
  *
@@ -383,7 +395,7 @@ declare function getVolumeMetadataForPath(pathname: string, opts?: Partial<Pick<
383
395
  * @param opts Optional settings (timeoutMs, linuxMountTablePaths)
384
396
  * @returns The mount point path (e.g., "/", "/System/Volumes/Data", "C:\\")
385
397
  */
386
- declare function getMountPointForPath(pathname: string, opts?: Partial<Pick<Options, "timeoutMs" | "linuxMountTablePaths">>): Promise<string>;
398
+ declare function getMountPointForPath(pathname: string, opts?: Partial<Pick<Options, "timeoutMs" | "linuxMountTablePaths" | "mountPoints">>): Promise<string>;
387
399
  /**
388
400
  * Retrieves metadata for all mounted volumes with optional filtering and
389
401
  * concurrency control.
package/dist/index.d.mts CHANGED
@@ -132,6 +132,18 @@ interface MountPoint {
132
132
  * @see {@link OptionsDefault} for the default values
133
133
  */
134
134
  interface Options {
135
+ /**
136
+ * Pre-fetched mount points to use instead of querying the system.
137
+ *
138
+ * When provided, functions like {@link getMountPointForPath} and
139
+ * {@link getVolumeMetadataForPath} will use these mount points for device ID
140
+ * matching instead of calling {@link getVolumeMountPoints} internally. This
141
+ * avoids redundant system queries when resolving multiple paths.
142
+ *
143
+ * Obtain via `getVolumeMountPoints({ includeSystemVolumes: true })` — system
144
+ * volumes must be included for device ID matching to work correctly.
145
+ */
146
+ mountPoints?: MountPoint[];
135
147
  /**
136
148
  * Timeout in milliseconds for filesystem operations.
137
149
  *
@@ -367,7 +379,7 @@ declare function getVolumeMetadata(mountPoint: string, opts?: Partial<Pick<Optio
367
379
  * @param pathname Path to any file or directory
368
380
  * @param opts Optional filesystem operation settings
369
381
  */
370
- declare function getVolumeMetadataForPath(pathname: string, opts?: Partial<Pick<Options, "timeoutMs" | "linuxMountTablePaths">>): Promise<VolumeMetadata>;
382
+ declare function getVolumeMetadataForPath(pathname: string, opts?: Partial<Pick<Options, "timeoutMs" | "linuxMountTablePaths" | "mountPoints">>): Promise<VolumeMetadata>;
371
383
  /**
372
384
  * Get the mount point path for an arbitrary file or directory path.
373
385
  *
@@ -383,7 +395,7 @@ declare function getVolumeMetadataForPath(pathname: string, opts?: Partial<Pick<
383
395
  * @param opts Optional settings (timeoutMs, linuxMountTablePaths)
384
396
  * @returns The mount point path (e.g., "/", "/System/Volumes/Data", "C:\\")
385
397
  */
386
- declare function getMountPointForPath(pathname: string, opts?: Partial<Pick<Options, "timeoutMs" | "linuxMountTablePaths">>): Promise<string>;
398
+ declare function getMountPointForPath(pathname: string, opts?: Partial<Pick<Options, "timeoutMs" | "linuxMountTablePaths" | "mountPoints">>): Promise<string>;
387
399
  /**
388
400
  * Retrieves metadata for all mounted volumes with optional filtering and
389
401
  * concurrency control.
package/dist/index.d.ts CHANGED
@@ -132,6 +132,18 @@ interface MountPoint {
132
132
  * @see {@link OptionsDefault} for the default values
133
133
  */
134
134
  interface Options {
135
+ /**
136
+ * Pre-fetched mount points to use instead of querying the system.
137
+ *
138
+ * When provided, functions like {@link getMountPointForPath} and
139
+ * {@link getVolumeMetadataForPath} will use these mount points for device ID
140
+ * matching instead of calling {@link getVolumeMountPoints} internally. This
141
+ * avoids redundant system queries when resolving multiple paths.
142
+ *
143
+ * Obtain via `getVolumeMountPoints({ includeSystemVolumes: true })` — system
144
+ * volumes must be included for device ID matching to work correctly.
145
+ */
146
+ mountPoints?: MountPoint[];
135
147
  /**
136
148
  * Timeout in milliseconds for filesystem operations.
137
149
  *
@@ -367,7 +379,7 @@ declare function getVolumeMetadata(mountPoint: string, opts?: Partial<Pick<Optio
367
379
  * @param pathname Path to any file or directory
368
380
  * @param opts Optional filesystem operation settings
369
381
  */
370
- declare function getVolumeMetadataForPath(pathname: string, opts?: Partial<Pick<Options, "timeoutMs" | "linuxMountTablePaths">>): Promise<VolumeMetadata>;
382
+ declare function getVolumeMetadataForPath(pathname: string, opts?: Partial<Pick<Options, "timeoutMs" | "linuxMountTablePaths" | "mountPoints">>): Promise<VolumeMetadata>;
371
383
  /**
372
384
  * Get the mount point path for an arbitrary file or directory path.
373
385
  *
@@ -383,7 +395,7 @@ declare function getVolumeMetadataForPath(pathname: string, opts?: Partial<Pick<
383
395
  * @param opts Optional settings (timeoutMs, linuxMountTablePaths)
384
396
  * @returns The mount point path (e.g., "/", "/System/Volumes/Data", "C:\\")
385
397
  */
386
- declare function getMountPointForPath(pathname: string, opts?: Partial<Pick<Options, "timeoutMs" | "linuxMountTablePaths">>): Promise<string>;
398
+ declare function getMountPointForPath(pathname: string, opts?: Partial<Pick<Options, "timeoutMs" | "linuxMountTablePaths" | "mountPoints">>): Promise<string>;
387
399
  /**
388
400
  * Retrieves metadata for all mounted volumes with optional filtering and
389
401
  * concurrency control.
package/dist/index.mjs CHANGED
@@ -1457,7 +1457,7 @@ async function getVolumeMetadataForPathImpl(pathname, opts, nativeFn2) {
1457
1457
  }
1458
1458
  async function findMountPointByDeviceId(resolved, resolvedStat, opts, nativeFn2) {
1459
1459
  const targetDev = resolvedStat.dev;
1460
- const mountPoints = await getVolumeMountPointsImpl(
1460
+ const mountPoints = opts.mountPoints ?? await getVolumeMountPointsImpl(
1461
1461
  { ...opts, includeSystemVolumes: true },
1462
1462
  nativeFn2
1463
1463
  );