@photostructure/fs-metadata 0.4.0 → 0.6.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/C++_REVIEW_TODO.md +291 -0
- package/CHANGELOG.md +39 -1
- package/CLAUDE.md +176 -0
- package/CONTRIBUTING.md +66 -0
- package/binding.gyp +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +360 -0
- package/dist/index.d.mts +360 -0
- package/dist/index.d.ts +360 -0
- package/dist/index.mjs +16 -15
- package/dist/index.mjs.map +1 -1
- package/jest.config.cjs +67 -6
- package/package.json +54 -47
- package/prebuilds/darwin-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-x64/@photostructure+fs-metadata.glibc.node +0 -0
- package/scripts/check-memory.mjs +123 -0
- package/scripts/clang-tidy.mjs +73 -0
- package/scripts/is-platform.mjs +12 -0
- package/scripts/post-build.mjs +21 -0
- package/scripts/sanitizers-test.sh +151 -0
- package/scripts/valgrind-test.mjs +83 -0
- package/scripts/valgrind-test.sh +85 -0
- package/src/async.ts +3 -3
- package/src/binding.cpp +3 -3
- package/src/common/error_utils.h +23 -0
- package/src/common/metadata_worker.h +4 -1
- package/src/darwin/hidden.cpp +13 -6
- package/src/darwin/volume_metadata.cpp +2 -2
- package/src/darwin/volume_mount_points.cpp +8 -1
- package/src/error.ts +3 -3
- package/src/fs.ts +1 -1
- package/src/glob.ts +2 -2
- package/src/hidden.ts +6 -6
- package/src/index.ts +19 -23
- package/src/linux/blkid_cache.cpp +23 -14
- package/src/linux/dev_disk.ts +2 -2
- package/src/linux/gio_mount_points.cpp +7 -7
- package/src/linux/gio_utils.cpp +19 -8
- package/src/linux/gio_volume_metadata.cpp +15 -15
- package/src/linux/mount_points.ts +9 -9
- package/src/linux/mtab.ts +7 -7
- package/src/linux/volume_metadata.cpp +7 -2
- package/src/object.ts +1 -1
- package/src/options.ts +3 -3
- package/src/path.ts +2 -2
- package/src/remote_info.ts +5 -5
- package/src/system_volume.ts +8 -8
- package/src/test-utils/assert.ts +2 -2
- package/src/test-utils/debuglog-child.ts +1 -3
- package/src/test-utils/debuglog-enabled-child.ts +10 -0
- package/src/test-utils/hidden-tests.ts +1 -1
- package/src/test-utils/platform.ts +3 -3
- package/src/test-utils/worker-thread-helper.cjs +88 -0
- package/src/types/native_bindings.ts +3 -3
- package/src/types/volume_metadata.ts +2 -2
- package/src/unc.ts +2 -2
- package/src/uuid.ts +1 -1
- package/src/volume_health_status.ts +6 -6
- package/src/volume_metadata.ts +20 -23
- package/src/volume_mount_points.ts +12 -17
- package/src/windows/drive_status.h +30 -13
- package/src/windows/hidden.cpp +32 -11
- package/src/windows/volume_metadata.cpp +17 -7
- package/tsup.config.ts +8 -2
- package/dist/types/array.d.ts +0 -25
- package/dist/types/async.d.ts +0 -42
- package/dist/types/debuglog.d.ts +0 -3
- package/dist/types/defer.d.ts +0 -10
- package/dist/types/dirname.d.ts +0 -1
- package/dist/types/error.d.ts +0 -17
- package/dist/types/fs.d.ts +0 -22
- package/dist/types/glob.d.ts +0 -17
- package/dist/types/hidden.d.ts +0 -29
- package/dist/types/index.d.ts +0 -91
- package/dist/types/linux/dev_disk.d.ts +0 -13
- package/dist/types/linux/mount_points.d.ts +0 -6
- package/dist/types/linux/mtab.d.ts +0 -47
- package/dist/types/mount_point.d.ts +0 -2
- package/dist/types/number.d.ts +0 -3
- package/dist/types/object.d.ts +0 -18
- package/dist/types/options.d.ts +0 -33
- package/dist/types/path.d.ts +0 -17
- package/dist/types/platform.d.ts +0 -4
- package/dist/types/random.d.ts +0 -12
- package/dist/types/remote_info.d.ts +0 -6
- package/dist/types/stack_path.d.ts +0 -2
- package/dist/types/string.d.ts +0 -37
- package/dist/types/string_enum.d.ts +0 -19
- package/dist/types/system_volume.d.ts +0 -14
- package/dist/types/types/hidden_metadata.d.ts +0 -32
- package/dist/types/types/mount_point.d.ts +0 -46
- package/dist/types/types/native_bindings.d.ts +0 -51
- package/dist/types/types/options.d.ts +0 -47
- package/dist/types/types/remote_info.d.ts +0 -33
- package/dist/types/types/volume_metadata.d.ts +0 -46
- package/dist/types/unc.d.ts +0 -11
- package/dist/types/units.d.ts +0 -38
- package/dist/types/uuid.d.ts +0 -16
- package/dist/types/volume_health_status.d.ts +0 -24
- package/dist/types/volume_metadata.d.ts +0 -8
- package/dist/types/volume_mount_points.d.ts +0 -6
- package/jest.config.base.cjs +0 -63
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents the detailed state of a file or directory's hidden attribute
|
|
3
|
+
*/
|
|
4
|
+
interface HiddenMetadata {
|
|
5
|
+
/**
|
|
6
|
+
* Whether the item is considered hidden by any method
|
|
7
|
+
*/
|
|
8
|
+
hidden: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Whether the item has a dot prefix (POSIX-style hidden). Windows doesn't
|
|
11
|
+
* care about dot prefixes.
|
|
12
|
+
*/
|
|
13
|
+
dotPrefix: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the item has system hidden flags set, like via `chflags` on macOS
|
|
16
|
+
* or on Windows via `GetFileAttributesW`
|
|
17
|
+
*/
|
|
18
|
+
systemFlag: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Indicates which hiding methods are supported on the current platform
|
|
21
|
+
*/
|
|
22
|
+
supported: {
|
|
23
|
+
/**
|
|
24
|
+
* Whether dot prefix hiding is supported on the current operating system
|
|
25
|
+
*/
|
|
26
|
+
dotPrefix: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Whether system flag hiding is supported
|
|
29
|
+
*/
|
|
30
|
+
systemFlag: boolean;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
type StringEnumType<T extends string> = {
|
|
35
|
+
[K in T]: K;
|
|
36
|
+
};
|
|
37
|
+
type StringEnum<T extends string> = StringEnumType<T> & {
|
|
38
|
+
values: T[];
|
|
39
|
+
size: number;
|
|
40
|
+
get(s: string | undefined): T | undefined;
|
|
41
|
+
};
|
|
42
|
+
type StringEnumKeys<Type> = Type extends StringEnum<infer X> ? X : never;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Health statuses for volumes (mostly applicable to Windows).
|
|
46
|
+
*
|
|
47
|
+
* - `healthy`: Volume is "OK": accessible and functioning normally
|
|
48
|
+
* - `timeout`: Volume could not be accessed before the specified timeout. It
|
|
49
|
+
* may be inaccessible or disconnected.
|
|
50
|
+
* - `inaccessible`: Volume exists but can't be accessed (permissions/locks)
|
|
51
|
+
* - `disconnected`: Network volume that's offline
|
|
52
|
+
* - `unknown`: Status can't be determined
|
|
53
|
+
*/
|
|
54
|
+
declare const VolumeHealthStatuses: StringEnum<"healthy" | "timeout" | "inaccessible" | "disconnected" | "unknown">;
|
|
55
|
+
type VolumeHealthStatus = StringEnumKeys<typeof VolumeHealthStatuses>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* A mount point is a location in the file system where a volume is mounted.
|
|
59
|
+
*
|
|
60
|
+
* @see https://en.wikipedia.org/wiki/Mount_(computing)
|
|
61
|
+
*/
|
|
62
|
+
interface MountPoint {
|
|
63
|
+
/**
|
|
64
|
+
* Mount location (like "/" or "C:\").
|
|
65
|
+
*/
|
|
66
|
+
mountPoint: string;
|
|
67
|
+
/**
|
|
68
|
+
* The type of file system on the volume, like `ext4`, `apfs`, or `ntfs`.
|
|
69
|
+
*
|
|
70
|
+
* Note: on Windows this may show as "ntfs" for remote filesystems, as that
|
|
71
|
+
* is how the filesystem is presented to the OS.
|
|
72
|
+
*/
|
|
73
|
+
fstype?: string;
|
|
74
|
+
/**
|
|
75
|
+
* On Windows, returns the health status of the volume.
|
|
76
|
+
*
|
|
77
|
+
* Note that this is only available on Windows, as both Linux and macOS are
|
|
78
|
+
* prohibitively expensive, requiring forking `fsck -N` or `diskutil
|
|
79
|
+
* verifyVolume`.
|
|
80
|
+
*
|
|
81
|
+
* If there are non-critical errors while extracting metadata, those error
|
|
82
|
+
* messages may be added to this field (say, from blkid or gio).
|
|
83
|
+
*
|
|
84
|
+
* @see {@link VolumeHealthStatuses} for values returned by Windows.
|
|
85
|
+
*/
|
|
86
|
+
status?: VolumeHealthStatus | string;
|
|
87
|
+
/**
|
|
88
|
+
* Indicates if this volume is primarily for system use (e.g., swap, snap
|
|
89
|
+
* loopbacks, EFI boot, or only system directories).
|
|
90
|
+
*
|
|
91
|
+
* Note: This is a best-effort classification and is not 100% accurate.
|
|
92
|
+
*
|
|
93
|
+
* @see {@link Options.systemPathPatterns} and {@link Options.systemFsTypes}
|
|
94
|
+
*/
|
|
95
|
+
isSystemVolume?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* If there are non-critical errors while extracting metadata, those errors
|
|
98
|
+
* may be added to this field.
|
|
99
|
+
*/
|
|
100
|
+
error?: Error | string;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Configuration options for filesystem operations.
|
|
105
|
+
*
|
|
106
|
+
* @see {@link optionsWithDefaults} for creating an options object with default values
|
|
107
|
+
* @see {@link OptionsDefault} for the default values
|
|
108
|
+
*/
|
|
109
|
+
interface Options {
|
|
110
|
+
/**
|
|
111
|
+
* Timeout in milliseconds for filesystem operations.
|
|
112
|
+
*
|
|
113
|
+
* Disable timeouts by setting this to 0.
|
|
114
|
+
*
|
|
115
|
+
* @see {@link TimeoutMsDefault}.
|
|
116
|
+
*/
|
|
117
|
+
timeoutMs: number;
|
|
118
|
+
/**
|
|
119
|
+
* Maximum number of concurrent filesystem operations.
|
|
120
|
+
*
|
|
121
|
+
* Defaults to {@link https://nodejs.org/api/os.html#osavailableparallelism | availableParallelism}.
|
|
122
|
+
*/
|
|
123
|
+
maxConcurrency: number;
|
|
124
|
+
/**
|
|
125
|
+
* On Linux and macOS, mount point pathnames that matches any of these glob
|
|
126
|
+
* patterns will have {@link MountPoint.isSystemVolume} set to true.
|
|
127
|
+
*
|
|
128
|
+
* @see {@link SystemPathPatternsDefault} for the default value
|
|
129
|
+
*/
|
|
130
|
+
systemPathPatterns: string[];
|
|
131
|
+
/**
|
|
132
|
+
* On Linux and macOS, volumes whose filesystem matches any of these strings
|
|
133
|
+
* will have {@link MountPoint.isSystemVolume} set to true.
|
|
134
|
+
*
|
|
135
|
+
* @see {@link SystemFsTypesDefault} for the default value
|
|
136
|
+
*/
|
|
137
|
+
systemFsTypes: string[];
|
|
138
|
+
/**
|
|
139
|
+
* On Linux, use the first mount point table in this array that is readable.
|
|
140
|
+
*
|
|
141
|
+
* @see {@link LinuxMountTablePathsDefault} for the default values
|
|
142
|
+
*/
|
|
143
|
+
linuxMountTablePaths: string[];
|
|
144
|
+
/**
|
|
145
|
+
* Should system volumes be included in result arrays? Defaults to true on
|
|
146
|
+
* Windows and false elsewhere.
|
|
147
|
+
*/
|
|
148
|
+
includeSystemVolumes: boolean;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Represents remote filesystem information.
|
|
153
|
+
*/
|
|
154
|
+
interface RemoteInfo {
|
|
155
|
+
/**
|
|
156
|
+
* We can sometimes fetch a URI of the resource (like "smb://server/share" or
|
|
157
|
+
* "file:///media/user/usb")
|
|
158
|
+
*/
|
|
159
|
+
uri?: string;
|
|
160
|
+
/**
|
|
161
|
+
* Protocol used to access the share.
|
|
162
|
+
*/
|
|
163
|
+
protocol?: string;
|
|
164
|
+
/**
|
|
165
|
+
* Does the protocol seem to be a remote filesystem?
|
|
166
|
+
*/
|
|
167
|
+
remote: boolean;
|
|
168
|
+
/**
|
|
169
|
+
* If remote, may include the username used to access the share.
|
|
170
|
+
*
|
|
171
|
+
* This will be undefined on NFS and other remote filesystem types that do
|
|
172
|
+
* authentication out of band.
|
|
173
|
+
*/
|
|
174
|
+
remoteUser?: string;
|
|
175
|
+
/**
|
|
176
|
+
* If remote, the ip or hostname hosting the share (like "rusty" or "10.1.1.3")
|
|
177
|
+
*/
|
|
178
|
+
remoteHost?: string;
|
|
179
|
+
/**
|
|
180
|
+
* If remote, the name of the share (like "homes")
|
|
181
|
+
*/
|
|
182
|
+
remoteShare?: string;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Metadata associated to a volume.
|
|
187
|
+
*
|
|
188
|
+
* @see https://en.wikipedia.org/wiki/Volume_(computing)
|
|
189
|
+
*/
|
|
190
|
+
interface VolumeMetadata extends RemoteInfo, MountPoint {
|
|
191
|
+
/**
|
|
192
|
+
* The name of the partition
|
|
193
|
+
*/
|
|
194
|
+
label?: string;
|
|
195
|
+
/**
|
|
196
|
+
* Total size in bytes
|
|
197
|
+
*/
|
|
198
|
+
size?: number;
|
|
199
|
+
/**
|
|
200
|
+
* Used size in bytes
|
|
201
|
+
*/
|
|
202
|
+
used?: number;
|
|
203
|
+
/**
|
|
204
|
+
* Available size in bytes
|
|
205
|
+
*/
|
|
206
|
+
available?: number;
|
|
207
|
+
/**
|
|
208
|
+
* Path to the device or service that the mountpoint is from.
|
|
209
|
+
*
|
|
210
|
+
* Examples include `/dev/sda1`, `nfs-server:/export`,
|
|
211
|
+
* `//username@remoteHost/remoteShare`, or `//cifs-server/share`.
|
|
212
|
+
*
|
|
213
|
+
* May be undefined for remote volumes.
|
|
214
|
+
*/
|
|
215
|
+
mountFrom?: string;
|
|
216
|
+
/**
|
|
217
|
+
* The name of the mount. This may match the resolved mountPoint.
|
|
218
|
+
*/
|
|
219
|
+
mountName?: string;
|
|
220
|
+
/**
|
|
221
|
+
* UUID for the volume, like "c9b08f6e-b392-11ef-bf19-4b13bb7db4b4".
|
|
222
|
+
*
|
|
223
|
+
* On windows, this _may_ be the 128-bit volume UUID, but if that is not
|
|
224
|
+
* available, like in the case of remote volumes, we fallback to the 32-bit
|
|
225
|
+
* volume serial number, rendered in lowercase hexadecimal.
|
|
226
|
+
*/
|
|
227
|
+
uuid?: string;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
type HideMethod = "dotPrefix" | "systemFlag" | "all" | "auto";
|
|
231
|
+
type SetHiddenResult = {
|
|
232
|
+
pathname: string;
|
|
233
|
+
actions: {
|
|
234
|
+
dotPrefix: boolean;
|
|
235
|
+
systemFlag: boolean;
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Default timeout in milliseconds for {@link Options.timeoutMs}.
|
|
241
|
+
*
|
|
242
|
+
* Note that this timeout may be insufficient for some devices, like spun-down
|
|
243
|
+
* optical drives or network shares that need to spin up or reconnect.
|
|
244
|
+
*/
|
|
245
|
+
declare const TimeoutMsDefault: 5000;
|
|
246
|
+
/**
|
|
247
|
+
* System paths and globs that indicate system volumes
|
|
248
|
+
*/
|
|
249
|
+
declare const SystemPathPatternsDefault: readonly ["/boot", "/boot/efi", "/dev", "/dev/**", "/proc/**", "/run", "/run/credentials/**", "/run/lock", "/run/snapd/**", "/run/user/*/doc", "/run/user/*/gvfs", "/snap/**", "/sys/**", "/tmp", "/var/tmp", "**/#snapshot", "/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"];
|
|
250
|
+
/**
|
|
251
|
+
* Filesystem types that indicate system volumes
|
|
252
|
+
*/
|
|
253
|
+
declare const SystemFsTypesDefault: readonly ["autofs", "binfmt_misc", "cgroup", "cgroup2", "configfs", "debugfs", "devpts", "devtmpfs", "efivarfs", "fusectl", "fuse.snapfuse", "hugetlbfs", "mqueue", "none", "proc", "pstore", "rootfs", "securityfs", "snap*", "squashfs", "sysfs", "tmpfs"];
|
|
254
|
+
declare const LinuxMountTablePathsDefault: readonly ["/proc/self/mounts", "/proc/mounts", "/etc/mtab"];
|
|
255
|
+
/**
|
|
256
|
+
* Should {@link getAllVolumeMetadata} include system volumes by
|
|
257
|
+
* default?
|
|
258
|
+
*/
|
|
259
|
+
declare const IncludeSystemVolumesDefault: boolean;
|
|
260
|
+
/**
|
|
261
|
+
* Default {@link Options} object.
|
|
262
|
+
*
|
|
263
|
+
* @see {@link optionsWithDefaults} for creating an options object with default values
|
|
264
|
+
*/
|
|
265
|
+
declare const OptionsDefault: Options;
|
|
266
|
+
/**
|
|
267
|
+
* Create an {@link Options} object using default values from
|
|
268
|
+
* {@link OptionsDefault} for missing fields.
|
|
269
|
+
*/
|
|
270
|
+
declare function optionsWithDefaults<T extends Options>(overrides?: Partial<T>): T;
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Configuration for system volume detection
|
|
274
|
+
*
|
|
275
|
+
* @see {@link MountPoint.isSystemVolume}
|
|
276
|
+
*/
|
|
277
|
+
type SystemVolumeConfig = Pick<Options, "systemPathPatterns" | "systemFsTypes">;
|
|
278
|
+
|
|
279
|
+
type GetVolumeMountPointOptions = Partial<Pick<Options, "timeoutMs" | "linuxMountTablePaths" | "maxConcurrency" | "includeSystemVolumes"> & SystemVolumeConfig>;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* List all active local and remote mount points on the system.
|
|
283
|
+
*
|
|
284
|
+
* Only readable directories are included in the results.
|
|
285
|
+
*
|
|
286
|
+
* Note that on Windows, `timeoutMs` will be used **per system call** and not
|
|
287
|
+
* for the entire operation.
|
|
288
|
+
*
|
|
289
|
+
* @param opts Optional filesystem operation settings to override default values
|
|
290
|
+
*/
|
|
291
|
+
declare function getVolumeMountPoints(opts?: Partial<GetVolumeMountPointOptions>): Promise<MountPoint[]>;
|
|
292
|
+
/**
|
|
293
|
+
* Get metadata for the volume at the given mount point.
|
|
294
|
+
*
|
|
295
|
+
* @param mountPoint Must be a non-blank string
|
|
296
|
+
* @param opts Optional filesystem operation settings
|
|
297
|
+
*/
|
|
298
|
+
declare function getVolumeMetadata(mountPoint: string, opts?: Partial<Pick<Options, "timeoutMs">>): Promise<VolumeMetadata>;
|
|
299
|
+
/**
|
|
300
|
+
* Retrieves metadata for all mounted volumes with optional filtering and
|
|
301
|
+
* concurrency control.
|
|
302
|
+
*
|
|
303
|
+
* @param opts - Optional configuration object
|
|
304
|
+
* @param opts.includeSystemVolumes - If true, includes system volumes in the
|
|
305
|
+
* results. Defaults to true on Windows and false elsewhere.
|
|
306
|
+
* @param opts.maxConcurrency - Maximum number of concurrent operations.
|
|
307
|
+
* Defaults to the system's available parallelism: see
|
|
308
|
+
* {@link https://nodejs.org/api/os.html#osavailableparallelism | os.availableParallelism()}
|
|
309
|
+
* @param opts.timeoutMs - Maximum time to wait for
|
|
310
|
+
* {@link getVolumeMountPointsImpl}, as well as **each** {@link getVolumeMetadataImpl}
|
|
311
|
+
* to complete. Defaults to {@link TimeoutMsDefault}
|
|
312
|
+
* @returns Promise that resolves to an array of either VolumeMetadata objects
|
|
313
|
+
* or error objects containing the mount point and error
|
|
314
|
+
* @throws Never - errors are caught and returned as part of the result array
|
|
315
|
+
*/
|
|
316
|
+
declare function getAllVolumeMetadata(opts?: Partial<Options> & {
|
|
317
|
+
includeSystemVolumes?: boolean;
|
|
318
|
+
}): Promise<VolumeMetadata[]>;
|
|
319
|
+
/**
|
|
320
|
+
* Check if a file or directory is hidden.
|
|
321
|
+
*
|
|
322
|
+
* Note that `path` may be _effectively_ hidden if any of the ancestor
|
|
323
|
+
* directories are hidden: use {@link isHiddenRecursive} to check for this.
|
|
324
|
+
*
|
|
325
|
+
* @param pathname Path to file or directory
|
|
326
|
+
* @returns Promise resolving to boolean indicating hidden state
|
|
327
|
+
*/
|
|
328
|
+
declare function isHidden(pathname: string): Promise<boolean>;
|
|
329
|
+
/**
|
|
330
|
+
* Check if a file or directory is hidden, or if any of its ancestor
|
|
331
|
+
* directories are hidden.
|
|
332
|
+
*
|
|
333
|
+
* @param pathname Path to file or directory
|
|
334
|
+
* @returns Promise resolving to boolean indicating hidden state
|
|
335
|
+
*/
|
|
336
|
+
declare function isHiddenRecursive(pathname: string): Promise<boolean>;
|
|
337
|
+
/**
|
|
338
|
+
* Get detailed metadata about the hidden state of a file or directory.
|
|
339
|
+
*
|
|
340
|
+
* @param pathname Path to file or directory
|
|
341
|
+
* @returns Promise resolving to metadata about the hidden state
|
|
342
|
+
*/
|
|
343
|
+
declare function getHiddenMetadata(pathname: string): Promise<HiddenMetadata>;
|
|
344
|
+
/**
|
|
345
|
+
* Set the hidden state of a file or directory
|
|
346
|
+
*
|
|
347
|
+
* @param pathname Path to file or directory
|
|
348
|
+
* @param hidden - Whether the item should be hidden (true) or visible (false)
|
|
349
|
+
* @param method Method to use for hiding the file or directory. The default
|
|
350
|
+
* is "auto", which is "dotPrefix" on Linux and macOS, and "systemFlag" on
|
|
351
|
+
* Windows. "all" will attempt to use all relevant methods for the current
|
|
352
|
+
* operating system.
|
|
353
|
+
* @returns Promise resolving the final name of the file or directory (as it
|
|
354
|
+
* will change on POSIX systems), and the action(s) taken.
|
|
355
|
+
* @throws {Error} If the file doesn't exist, permissions are insufficient, or
|
|
356
|
+
* the requested method is unsupported
|
|
357
|
+
*/
|
|
358
|
+
declare function setHidden(pathname: string, hidden: boolean, method?: HideMethod): Promise<SetHiddenResult>;
|
|
359
|
+
|
|
360
|
+
export { type GetVolumeMountPointOptions, type HiddenMetadata, type HideMethod, IncludeSystemVolumesDefault, LinuxMountTablePathsDefault, type MountPoint, type Options, OptionsDefault, type SetHiddenResult, type StringEnum, type StringEnumKeys, type StringEnumType, SystemFsTypesDefault, SystemPathPatternsDefault, type SystemVolumeConfig, TimeoutMsDefault, type VolumeHealthStatus, VolumeHealthStatuses, type VolumeMetadata, getAllVolumeMetadata, getHiddenMetadata, getVolumeMetadata, getVolumeMountPoints, isHidden, isHiddenRecursive, optionsWithDefaults, setHidden };
|