1 | export interface IMounterOptions {
|
2 | |
3 |
|
4 |
|
5 |
|
6 |
|
7 | hdiutil?: string | null;
|
8 | }
|
9 | export interface IMounterAttachOptions {
|
10 | |
11 |
|
12 |
|
13 | readonly?: boolean;
|
14 | |
15 |
|
16 |
|
17 | nobrowse?: boolean;
|
18 | }
|
19 | export interface IMounterEjectOptions {
|
20 | |
21 |
|
22 |
|
23 | force?: boolean;
|
24 | }
|
25 | export interface IMounterDevice {
|
26 | |
27 |
|
28 |
|
29 | devEntry: string;
|
30 | |
31 |
|
32 |
|
33 | potentiallyMountable: boolean;
|
34 | |
35 |
|
36 |
|
37 | contentHint?: string;
|
38 | |
39 |
|
40 |
|
41 | unmappedContentHint?: string;
|
42 | |
43 |
|
44 |
|
45 | volumeKind?: string;
|
46 | |
47 |
|
48 |
|
49 | mountPoint?: string;
|
50 | }
|
51 | export interface IMounterAttachInfo {
|
52 | |
53 |
|
54 |
|
55 | devices: IMounterDevice[];
|
56 | |
57 |
|
58 |
|
59 | eject(options?: Readonly<IMounterEjectOptions> | null): Promise<void>;
|
60 | |
61 |
|
62 |
|
63 | ejectSync(options?: Readonly<IMounterEjectOptions> | null): void;
|
64 | }
|
65 |
|
66 |
|
67 |
|
68 | export declare class Mounter {
|
69 | |
70 |
|
71 |
|
72 | hdiutil: string;
|
73 | |
74 |
|
75 |
|
76 |
|
77 |
|
78 | constructor(options?: Readonly<IMounterOptions> | null);
|
79 | /**
|
80 | * Attach a disk image.
|
81 | *
|
82 | * @param file Path to disk image.
|
83 | * @param options Options object.
|
84 | * @param ejectOnExit Eject on exit options, or null.
|
85 | * @returns Info object.
|
86 | */
|
87 | attach(file: string, options?: Readonly<IMounterAttachOptions> | null, ejectOnExit?: Readonly<IMounterEjectOptions> | null): Promise<IMounterAttachInfo>;
|
88 | /**
|
89 | * Attach a disk image.
|
90 | *
|
91 | * @param file Path to disk image.
|
92 | * @param options Options object.
|
93 | * @param ejectOnExit Eject on exit options, or null.
|
94 | * @returns Info object.
|
95 | */
|
96 | attachSync(file: string, options?: Readonly<IMounterAttachOptions> | null, ejectOnExit?: Readonly<IMounterEjectOptions> | null): IMounterAttachInfo;
|
97 | /**
|
98 | * Eject a disk image.
|
99 | *
|
100 | * @param file Path to device file or volume mount point.
|
101 | * @param options Options object.
|
102 | */
|
103 | eject(file: string, options?: Readonly<IMounterEjectOptions> | null): Promise<void>;
|
104 | /**
|
105 | * Eject a disk image.
|
106 | *
|
107 | * @param file Path to device file or volume mount point.
|
108 | * @param options Options object.
|
109 | */
|
110 | ejectSync(file: string, options?: Readonly<IMounterEjectOptions> | null): void;
|
111 | /**
|
112 | * Create args for attach.
|
113 | *
|
114 | * @param file Path to disk image.
|
115 | * @param options Options object.
|
116 | * @returns Argument list.
|
117 | */
|
118 | protected _argsAttach(file: string, options?: Readonly<IMounterAttachOptions> | null): string[];
|
119 | /**
|
120 | * Create args for eject.
|
121 | *
|
122 | * @param file Path to device file or volume mount point.
|
123 | * @param options Options object.
|
124 | * @returns Argument list.
|
125 | */
|
126 | protected _argsEject(file: string, options?: Readonly<IMounterEjectOptions> | null): string[];
|
127 | /**
|
128 | * Run hdiutil attach command, returning the devices list on success.
|
129 | *
|
130 | * @param args CLI args.
|
131 | * @returns Devices list.
|
132 | */
|
133 | protected _runAttach(args: Readonly<string[]>): Promise<IMounterDevice[]>;
|
134 | /**
|
135 | * Run hdiutil attach command, returning the devices list on success.
|
136 | *
|
137 | * @param args CLI args.
|
138 | * @returns Devices list.
|
139 | */
|
140 | protected _runAttachSync(args: Readonly<string[]>): IMounterDevice[];
|
141 | /**
|
142 | * Run hdiutil eject command.
|
143 | *
|
144 | * @param args CLI args.
|
145 | */
|
146 | protected _runEject(args: Readonly<string[]>): Promise<void>;
|
147 | /**
|
148 | * Run hdiutil eject command.
|
149 | *
|
150 | * @param args CLI args.
|
151 | */
|
152 | protected _runEjectSync(args: Readonly<string[]>): void;
|
153 | /**
|
154 | * Create file argument from file path.
|
155 | *
|
156 | * @param file File path.
|
157 | * @returns A path for use as argument.
|
158 | */
|
159 | protected _fileArg(file: string): string;
|
160 | /**
|
161 | * Parse devices plist into devices list.
|
162 | *
|
163 | * @param xml XML plist.
|
164 | * @returns Devices list.
|
165 | */
|
166 | protected _parseDevices(xml: string): IMounterDevice[];
|
167 | /**
|
168 | * Find the root device, null on empty list.
|
169 | *
|
170 | * @param devices Device list.
|
171 | * @returns Root device or null if an empty list.
|
172 | */
|
173 | protected _findRootDevice(devices: Readonly<Readonly<IMounterDevice>[]>): IMounterDevice | null;
|
174 | /**
|
175 | * Create ejects callback from a list of devices.
|
176 | *
|
177 | * @param devices Device list.
|
178 | * @param ejectOnExit Eject on exit options, or null.
|
179 | * @returns Callback function.
|
180 | */
|
181 | protected _createEjects(devices: Readonly<Readonly<IMounterDevice>[]>, ejectOnExit?: null): {
|
182 | |
183 |
|
184 |
|
185 |
|
186 |
|
187 | eject: (options?: IMounterEjectOptions | null) => Promise<void>;
|
188 | |
189 |
|
190 |
|
191 |
|
192 |
|
193 | ejectSync: (options?: IMounterEjectOptions | null) => void;
|
194 | };
|
195 | }
|