@breadstone-infrastructure/utilities 0.0.71 → 0.0.72

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.
Files changed (68) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/IO/Directory.d.ts +8 -0
  3. package/IO/Directory.d.ts.map +1 -1
  4. package/IO/Directory.js +10 -0
  5. package/IO/Directory.js.map +1 -1
  6. package/IO/File.d.ts +47 -0
  7. package/IO/File.d.ts.map +1 -1
  8. package/IO/File.js +104 -0
  9. package/IO/File.js.map +1 -1
  10. package/IO/FileCache.d.ts +46 -0
  11. package/IO/FileCache.d.ts.map +1 -0
  12. package/IO/FileCache.js +94 -0
  13. package/IO/FileCache.js.map +1 -0
  14. package/IO/FileManifest.d.ts +57 -0
  15. package/IO/FileManifest.d.ts.map +1 -0
  16. package/IO/FileManifest.js +105 -0
  17. package/IO/FileManifest.js.map +1 -0
  18. package/IO/FileSystem.d.ts +488 -0
  19. package/IO/FileSystem.d.ts.map +1 -0
  20. package/IO/FileSystem.js +667 -0
  21. package/IO/FileSystem.js.map +1 -0
  22. package/IO/FileTracker.d.ts +73 -0
  23. package/IO/FileTracker.d.ts.map +1 -0
  24. package/IO/FileTracker.js +116 -0
  25. package/IO/FileTracker.js.map +1 -0
  26. package/IO/Interfaces/IDirectory.d.ts +115 -0
  27. package/IO/Interfaces/IDirectory.d.ts.map +1 -0
  28. package/IO/Interfaces/IDirectory.js +3 -0
  29. package/IO/Interfaces/IDirectory.js.map +1 -0
  30. package/IO/Interfaces/IFile.d.ts +152 -0
  31. package/IO/Interfaces/IFile.d.ts.map +1 -0
  32. package/IO/Interfaces/IFile.js +4 -0
  33. package/IO/Interfaces/IFile.js.map +1 -0
  34. package/IO/Interfaces/IFileCache.d.ts +56 -0
  35. package/IO/Interfaces/IFileCache.d.ts.map +1 -0
  36. package/IO/Interfaces/IFileCache.js +3 -0
  37. package/IO/Interfaces/IFileCache.js.map +1 -0
  38. package/IO/Interfaces/IFileSystem.d.ts +43 -0
  39. package/IO/Interfaces/IFileSystem.d.ts.map +1 -0
  40. package/IO/Interfaces/IFileSystem.js +4 -0
  41. package/IO/Interfaces/IFileSystem.js.map +1 -0
  42. package/IO/Interfaces/IFileTracker.d.ts +15 -0
  43. package/IO/Interfaces/IFileTracker.d.ts.map +1 -0
  44. package/IO/Interfaces/IFileTracker.js +4 -0
  45. package/IO/Interfaces/IFileTracker.js.map +1 -0
  46. package/IO/Interfaces/IPath.d.ts +97 -0
  47. package/IO/Interfaces/IPath.d.ts.map +1 -0
  48. package/IO/Interfaces/IPath.js +4 -0
  49. package/IO/Interfaces/IPath.js.map +1 -0
  50. package/IO/vNext/FileCache.d.ts +1 -1
  51. package/IO/vNext/FileTracker.d.ts +73 -0
  52. package/IO/vNext/FileTracker.d.ts.map +1 -0
  53. package/IO/vNext/FileTracker.js +116 -0
  54. package/IO/vNext/FileTracker.js.map +1 -0
  55. package/IO/vNext/Interfaces/IFileTracker.d.ts +15 -0
  56. package/IO/vNext/Interfaces/IFileTracker.d.ts.map +1 -0
  57. package/IO/vNext/Interfaces/IFileTracker.js +4 -0
  58. package/IO/vNext/Interfaces/IFileTracker.js.map +1 -0
  59. package/Index.d.ts +7 -4
  60. package/Index.d.ts.map +1 -1
  61. package/Index.js +7 -4
  62. package/Index.js.map +1 -1
  63. package/README.md +36 -36
  64. package/package.json +2 -2
  65. package/IO/SymbolikLink.d.ts +0 -6
  66. package/IO/SymbolikLink.d.ts.map +0 -1
  67. package/IO/SymbolikLink.js +0 -10
  68. package/IO/SymbolikLink.js.map +0 -1
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ // #region Imports
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.FileManifest = void 0;
5
+ const Directory_1 = require("./Directory");
6
+ const File_1 = require("./File");
7
+ const Path_1 = require("./Path");
8
+ // #endregion
9
+ /**
10
+ * A self-contained class that tracks generated files and performs cleanup.
11
+ *
12
+ * @public
13
+ */
14
+ class FileManifest {
15
+ // #region Fields
16
+ _manifestPath;
17
+ _currentFiles;
18
+ _previousFiles;
19
+ // #endregion
20
+ // #region Ctor
21
+ /**
22
+ * Constructs a new instance of the `FileManifest` class.
23
+ *
24
+ * @public
25
+ * @param options - Options for the manifest, including the path to the manifest file.
26
+ */
27
+ constructor(options) {
28
+ this._manifestPath = Path_1.Path.resolve(options.manifestPath);
29
+ this._previousFiles = new Set();
30
+ this._currentFiles = new Set();
31
+ }
32
+ // #endregion
33
+ // #region Methods
34
+ /**
35
+ * Loads the previous file list from the manifest file.
36
+ *
37
+ * @public
38
+ */
39
+ async load() {
40
+ if (File_1.File.exists(this._manifestPath)) {
41
+ const raw = await File_1.File.readAllTextAsync(this._manifestPath);
42
+ const data = JSON.parse(raw);
43
+ this._previousFiles = new Set(data.map((p) => Path_1.Path.resolve(p)));
44
+ }
45
+ }
46
+ /**
47
+ * Adds a file path to the current list of generated files.
48
+ *
49
+ * @public
50
+ * @param filePath - The path of the file to add, can be relative or absolute
51
+ */
52
+ add(filePath) {
53
+ const resolved = Path_1.Path.resolve(filePath);
54
+ this._currentFiles.add(resolved);
55
+ }
56
+ /**
57
+ * Deletes all files that were previously generated but not in the current run.
58
+ *
59
+ * @public
60
+ */
61
+ async cleanup() {
62
+ const toDelete = [...this._previousFiles].filter((f) => !this._currentFiles.has(f));
63
+ for (const file of toDelete) {
64
+ try {
65
+ // eslint-disable-next-line no-await-in-loop
66
+ await File_1.File.deleteAsync(file);
67
+ }
68
+ catch (err) {
69
+ console.warn(`[file-manifest] Failed to delete ${file}:`, err);
70
+ }
71
+ }
72
+ }
73
+ /**
74
+ * Saves the current file list to the manifest file.
75
+ *
76
+ * @public
77
+ */
78
+ async save() {
79
+ const sorted = [...this._currentFiles].sort();
80
+ const dir = Path_1.Path.getDirectoryName(this._manifestPath);
81
+ if (!Directory_1.Directory.exists(dir)) {
82
+ await Directory_1.Directory.createAsync(dir);
83
+ }
84
+ await File_1.File.writeAllTextAsync(this._manifestPath, JSON.stringify(sorted, null, 2), 'utf-8');
85
+ }
86
+ /**
87
+ * Returns the list of files tracked in the current run.
88
+ *
89
+ * @public
90
+ */
91
+ getTrackedFiles() {
92
+ return Array.from(this._currentFiles);
93
+ }
94
+ /**
95
+ * Clears the manifest's internal state (useful for testing or resetting).
96
+ *
97
+ * @public
98
+ */
99
+ reset() {
100
+ this._currentFiles.clear();
101
+ this._previousFiles.clear();
102
+ }
103
+ }
104
+ exports.FileManifest = FileManifest;
105
+ //# sourceMappingURL=FileManifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileManifest.js","sourceRoot":"","sources":["../../src/IO/FileManifest.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAElB,2CAAwC;AACxC,iCAA8B;AAC9B,iCAA8B;AAE9B,aAAa;AAEb;;;;GAIG;AACH,MAAa,YAAY;IAErB,iBAAiB;IAEA,aAAa,CAAS;IACtB,aAAa,CAAc;IACpC,cAAc,CAAc;IAEpC,aAAa;IAEb,eAAe;IAEf;;;;;OAKG;IACH,YAAmB,OAAiC;QAChD,IAAI,CAAC,aAAa,GAAG,WAAI,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACxD,IAAI,CAAC,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;QACxC,IAAI,CAAC,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;IAC3C,CAAC;IAED,aAAa;IAEb,kBAAkB;IAElB;;;;OAIG;IACI,KAAK,CAAC,IAAI;QACb,IAAI,WAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC;YAClC,MAAM,GAAG,GAAG,MAAM,WAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAC5D,MAAM,IAAI,GAAkB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC5C,IAAI,CAAC,cAAc,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CA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CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAC/F,CAAC;IAED;;;;OAIG;IACI,eAAe;QAClB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC1C,CAAC;IAED;;;;OAIG;IACI,KAAK;QACR,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;QAC3B,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC;CAIJ;AA3GD,oCA2GC"}
@@ -0,0 +1,488 @@
1
+ import { EventEmitter } from 'node:stream';
2
+ import { Encoding } from './Encoding';
3
+ import { IGlobOptions } from './Glob';
4
+ import { JSONObject } from './Json';
5
+ import { IResxEntry } from './Resx';
6
+ import { SymbolicLink } from './SymbolicLink';
7
+ import { IFileSystem, IFileSystemEventMap } from './Interfaces/IFileSystem';
8
+ /**
9
+ * Provides a complete implementation of IFileSystem using the static methods of File, Directory, and Path,
10
+ * and emits events for file and directory actions.
11
+ *
12
+ * @public
13
+ */
14
+ export declare class FileSystem extends EventEmitter<IFileSystemEventMap> implements IFileSystem {
15
+ constructor();
16
+ /**
17
+ * Gets the path separator for the current platform.
18
+ *
19
+ * @public
20
+ * @returns The path separator as a string.
21
+ */
22
+ get pathSeparator(): string;
23
+ /**
24
+ * Checks if a file or directory exists and returns its type.
25
+ *
26
+ * @public
27
+ * @param inputPath - The path to the file or directory.
28
+ * @returns 'file' if it is a file, 'directory' if it is a directory, or 'unknown' if it does not exist or is neither.
29
+ */
30
+ isFileOrDirectory(inputPath: string): 'file' | 'directory' | 'unknown';
31
+ /**
32
+ * Determines whether the specified file exists.
33
+ *
34
+ * @public
35
+ * @param path The file to check.
36
+ * @returns `true` if the file exists; otherwise, `false`.
37
+ * @emits fileChanged
38
+ */
39
+ fileExists(path: string): boolean;
40
+ /**
41
+ * Copies a file from one location to another.
42
+ *
43
+ * @public
44
+ * @param sourceFileName The name of the file to copy.
45
+ * @param destFileName The name of the destination file.
46
+ * @param overwrite Whether to overwrite the destination file if it exists.
47
+ * @emits fileCreated
48
+ */
49
+ fileCopy(sourceFileName: string, destFileName: string, overwrite?: boolean): void;
50
+ /**
51
+ * Reads the entire text content of a file.
52
+ *
53
+ * @public
54
+ * @param path The path to the file.
55
+ * @param encoding The encoding to use when reading the file.
56
+ * @param validateCase Whether to validate the case of the file path.
57
+ * @returns The text content of the file.
58
+ * @emits fileChanged
59
+ */
60
+ fileReadAllText(path: string, encoding?: Encoding, validateCase?: boolean): string;
61
+ /**
62
+ * Asynchronously reads the entire text content of a file.
63
+ *
64
+ * @public
65
+ * @param path The path to the file.
66
+ * @param encoding The encoding to use when reading the file.
67
+ * @param validateCase Whether to validate the case of the file path.
68
+ * @returns A promise that resolves with the text content of the file.
69
+ * @emits fileChanged
70
+ */
71
+ fileReadAllTextAsync(path: string, encoding?: Encoding, validateCase?: boolean): Promise<string>;
72
+ /**
73
+ * Reads all bytes from a file.
74
+ *
75
+ * @public
76
+ * @param path The path to the file.
77
+ * @returns The content of the file as a Buffer.
78
+ * @emits fileChanged
79
+ */
80
+ fileReadAllBytes(path: string): Buffer;
81
+ /**
82
+ * Asynchronously reads all bytes from a file.
83
+ *
84
+ * @public
85
+ * @param path The path to the file.
86
+ * @returns A promise that resolves with the content of the file as a Buffer.
87
+ * @emits fileChanged
88
+ */
89
+ fileReadAllBytesAsync(path: string): Promise<Buffer>;
90
+ /**
91
+ * Writes text to a file, overwriting it if it exists.
92
+ *
93
+ * @public
94
+ * @param path The path to the file.
95
+ * @param contents The text content to write.
96
+ * @param encoding The encoding to use when writing the file.
97
+ * @param validateCase Whether to validate the case of the file path.
98
+ * @emits fileChanged
99
+ */
100
+ fileWriteAllText(path: string, contents: string, encoding?: Encoding, validateCase?: boolean): void;
101
+ /**
102
+ * Asynchronously writes text to a file, overwriting it if it exists.
103
+ *
104
+ * @public
105
+ * @param path The path to the file.
106
+ * @param contents The text content to write.
107
+ * @param encoding The encoding to use when writing the file.
108
+ * @param validateCase Whether to validate the case of the file path.
109
+ * @returns A promise that resolves when the write operation is complete.
110
+ * @emits fileChanged
111
+ */
112
+ fileWriteAllTextAsync(path: string, contents: string, encoding?: Encoding, validateCase?: boolean): Promise<void>;
113
+ /**
114
+ * Writes JSON data to a file, overwriting it if it exists.
115
+ *
116
+ * @public
117
+ * @param path The path to the file.
118
+ * @param data The JSON data to write.
119
+ * @param encoding The encoding to use when writing the file.
120
+ * @emits fileChanged
121
+ */
122
+ fileWriteAllJson(path: string, data: unknown, encoding?: Encoding): void;
123
+ /**
124
+ * Asynchronously writes JSON data to a file, overwriting it if it exists.
125
+ *
126
+ * @public
127
+ * @param path The path to the file.
128
+ * @param data The JSON data to write.
129
+ * @param encoding The encoding to use when writing the file.
130
+ * @returns A promise that resolves when the write operation is complete.
131
+ * @emits fileChanged
132
+ */
133
+ fileWriteAllJsonAsync(path: string, data: unknown, encoding?: Encoding): Promise<void>;
134
+ /**
135
+ * Deletes the specified file.
136
+ *
137
+ * @public
138
+ * @param path The file to delete.
139
+ * @emits fileDeleted
140
+ */
141
+ fileDelete(path: string): void;
142
+ /**
143
+ * Asynchronously deletes the specified file.
144
+ *
145
+ * @public
146
+ * @param path The file to delete.
147
+ * @returns A promise that resolves when the file is deleted.
148
+ * @emits fileDeleted
149
+ */
150
+ fileDeleteAsync(path: string): Promise<void>;
151
+ /**
152
+ * Moves a file from one location to another.
153
+ *
154
+ * @public
155
+ * @param sourceFileName The name of the file to move.
156
+ * @param destFileName The name of the destination file.
157
+ * @emits fileDeleted
158
+ * @emits fileCreated
159
+ */
160
+ fileMove(sourceFileName: string, destFileName: string): void;
161
+ /**
162
+ * Reads all JSON data from a file.
163
+ *
164
+ * @public
165
+ * @param file The file to read.
166
+ * @returns The JSON object.
167
+ * @emits fileChanged
168
+ */
169
+ fileReadAllJson(file: string): JSONObject;
170
+ /**
171
+ * Reads all Resx entries from a file.
172
+ *
173
+ * @public
174
+ * @param file The file to read.
175
+ * @returns An array of Resx entries.
176
+ * @emits fileChanged
177
+ */
178
+ fileReadAllResx(file: string): Array<IResxEntry>;
179
+ /**
180
+ * Reads and parses an XML file.
181
+ *
182
+ * @public
183
+ * @param file The XML file to read.
184
+ * @returns The parsed XML object.
185
+ * @emits fileChanged
186
+ */
187
+ fileReadAllXml<T = unknown>(file: string): T;
188
+ /**
189
+ * Creates a hash from a file.
190
+ *
191
+ * @public
192
+ * @param file The file to hash.
193
+ * @param algorithm The hashing algorithm to use (default is 'sha1').
194
+ * @param encoding The encoding of the hash (default is 'hex').
195
+ * @returns A promise that resolves with the hash as a string or Buffer.
196
+ * @emits fileChanged
197
+ */
198
+ fileHash(file: string, algorithm?: 'sha1' | 'md5', encoding?: 'hex' | 'binary'): Promise<string | Buffer>;
199
+ /**
200
+ * Gets a list of files matching the specified glob pattern.
201
+ *
202
+ * @public
203
+ * @param pattern The glob pattern to match files against.
204
+ * @returns An array of matching file paths.
205
+ */
206
+ fileGlob(pattern: string | Array<string>): Array<string>;
207
+ /**
208
+ * Gets the locale from a file.
209
+ *
210
+ * @public
211
+ * @param file The file to read the locale from.
212
+ * @param defaultLocale The default locale to return if none is found.
213
+ * @returns The locale string.
214
+ */
215
+ fileGetLocale(file: string, defaultLocale?: string): string;
216
+ /**
217
+ * Gets the size of a file.
218
+ *
219
+ * @public
220
+ * @param file The file to check.
221
+ * @returns The size of the file in bytes.
222
+ */
223
+ fileSize(file: string): number;
224
+ /**
225
+ * Creates a symbolic link.
226
+ *
227
+ * @public
228
+ * @param src The source file.
229
+ * @param dest The destination link.
230
+ * @param symbolicLink The symbolic link options.
231
+ * @emits fileCreated
232
+ */
233
+ fileCreateSymbolicLink(src: string, dest: string, symbolicLink: SymbolicLink): void;
234
+ /**
235
+ * Creates a directory.
236
+ *
237
+ * @public
238
+ * @param path The directory to create.
239
+ * @emits directoryCreated
240
+ */
241
+ directoryCreate(path: string): void;
242
+ /**
243
+ * Asynchronously creates a directory.
244
+ *
245
+ * @public
246
+ * @param path The directory to create.
247
+ * @returns A promise that resolves when the directory is created.
248
+ * @emits directoryCreated
249
+ */
250
+ directoryCreateAsync(path: string): Promise<void>;
251
+ /**
252
+ * Deletes an directory.
253
+ *
254
+ * @public
255
+ * @param path The directory to delete.
256
+ * @emits directoryDeleted
257
+ */
258
+ directoryDelete(path: string): void;
259
+ /**
260
+ * Asynchronously deletes an directory.
261
+ *
262
+ * @public
263
+ * @param path The directory to delete.
264
+ * @returns A promise that resolves when the directory is deleted.
265
+ * @emits directoryDeleted
266
+ */
267
+ directoryDeleteAsync(path: string): Promise<void>;
268
+ /**
269
+ * Checks if a directory exists.
270
+ *
271
+ * @public
272
+ * @param path The path to the directory.
273
+ * @returns `true` if the directory exists; otherwise, `false`.
274
+ * @emits directoryChanged
275
+ */
276
+ directoryExists(path: string): boolean;
277
+ /**
278
+ * Asynchronously checks if a directory exists.
279
+ *
280
+ * @public
281
+ * @param path The path to the directory.
282
+ * @returns A promise that resolves to `true` if the directory exists; otherwise, `false`.
283
+ * @emits directoryChanged
284
+ */
285
+ directoryExistsAsync(path: string): Promise<boolean>;
286
+ /**
287
+ * Counts the number of files and directories in a directory.
288
+ *
289
+ * @public
290
+ * @param path The directory path.
291
+ * @returns The number of files and directories.
292
+ */
293
+ directoryCount(path: string): number;
294
+ /**
295
+ * Asynchronously counts the number of files and directories in a directory.
296
+ *
297
+ * @public
298
+ * @param path The directory path.
299
+ * @returns A promise that resolves to the number of files and directories.
300
+ */
301
+ directoryCountAsync(path: string): Promise<number>;
302
+ /**
303
+ * Gets the size of a directory.
304
+ *
305
+ * @public
306
+ * @param path The directory path.
307
+ * @returns The size of the directory in bytes.
308
+ */
309
+ directorySize(path: string): number;
310
+ /**
311
+ * Asynchronously gets the size of a directory.
312
+ *
313
+ * @public
314
+ * @param path The directory path.
315
+ * @returns A promise that resolves to the size of the directory in bytes.
316
+ */
317
+ directorySizeAsync(path: string): Promise<number>;
318
+ /**
319
+ * Retrieves the parent directory of the specified path.
320
+ *
321
+ * @public
322
+ * @param path The path for which to retrieve the parent directory.
323
+ * @returns The parent directory path or null if not available.
324
+ */
325
+ directoryGetParent(path: string): string | null;
326
+ /**
327
+ * Asynchronously retrieves the parent directory of the specified path.
328
+ *
329
+ * @public
330
+ * @param path The path for which to retrieve the parent directory.
331
+ * @returns A promise that resolves to the parent directory path or null if not available.
332
+ */
333
+ directoryGetParentAsync(path: string): Promise<string | null>;
334
+ /**
335
+ * Lists all files in a directory recursively in a synchronous fashion.
336
+ *
337
+ * @public
338
+ * @param path The root directory path.
339
+ * @returns An iterable iterator of file paths.
340
+ */
341
+ directoryWalk(path: string): IterableIterator<string>;
342
+ /**
343
+ * Lists all files in a directory recursively in an asynchronous fashion.
344
+ *
345
+ * @public
346
+ * @param path The root directory path.
347
+ * @returns An async iterable iterator of file paths.
348
+ */
349
+ directoryWalkAsync(path: string): AsyncIterableIterator<string>;
350
+ /**
351
+ * Finds directories using glob patterns.
352
+ *
353
+ * @public
354
+ * @param pattern The globbing pattern(s).
355
+ * @returns An array of directory paths.
356
+ */
357
+ directoryGlob(pattern: string | Array<string>): Array<string>;
358
+ /**
359
+ * Asynchronously finds directories using glob patterns.
360
+ *
361
+ * @public
362
+ * @param pattern The globbing pattern(s).
363
+ * @returns A promise that resolves to an array of directory paths.
364
+ */
365
+ directoryGlobAsync(pattern: string | Array<string>): Promise<Array<string>>;
366
+ /**
367
+ * Copies a directory to a new location.
368
+ *
369
+ * @public
370
+ * @param sourcePath The source directory path.
371
+ * @param targetPath The target directory path.
372
+ * @emits directoryCreated
373
+ */
374
+ directoryCopy(sourcePath: string, targetPath: string): void;
375
+ /**
376
+ * Asynchronously copies a directory to a new location.
377
+ *
378
+ * @public
379
+ * @param sourcePath The source directory path.
380
+ * @param targetPath The target directory path.
381
+ * @returns A promise that resolves when the copy operation is complete.
382
+ * @emits directoryCreated
383
+ */
384
+ directoryCopyAsync(sourcePath: string, targetPath: string): Promise<void>;
385
+ /**
386
+ * Changes the extension of a path.
387
+ *
388
+ * @public
389
+ * @param path The original path.
390
+ * @param extension The new extension to set.
391
+ * @returns The path with the new extension.
392
+ */
393
+ pathChangeExtension(path: string, extension: string): string;
394
+ /**
395
+ * Gets the directory name of a path.
396
+ *
397
+ * @public
398
+ * @param path The path to get the directory name from.
399
+ * @returns The directory name of the path.
400
+ */
401
+ pathGetDirectoryName(path: string): string;
402
+ /**
403
+ * Gets the directory segments of a path.
404
+ *
405
+ * @public
406
+ * @param path The path to get the directory segments from.
407
+ * @returns An array of directory segments.
408
+ */
409
+ pathGetDirectorySegments(path: string): Array<string>;
410
+ /**
411
+ * Gets the file name of a path.
412
+ *
413
+ * @public
414
+ * @param path The path to get the file name from.
415
+ * @returns The file name of the path.
416
+ */
417
+ pathGetFileName(path: string): string;
418
+ /**
419
+ * Gets the file name without extension from a path.
420
+ *
421
+ * @public
422
+ * @param path The path to get the file name without extension from.
423
+ * @returns The file name without extension.
424
+ */
425
+ pathGetFileNameWithoutExtension(path: string): string;
426
+ /**
427
+ * Gets the extension of a path.
428
+ *
429
+ * @public
430
+ * @param path The path to get the extension from.
431
+ * @param includeDot Whether to include the dot in the extension.
432
+ * @returns The extension of the path.
433
+ */
434
+ pathGetExtension(path: string, includeDot?: boolean): string;
435
+ /**
436
+ * Gets a random file name.
437
+ *
438
+ * @public
439
+ * @param alphanumeric Whether to use alphanumeric characters in the file name.
440
+ * @returns A random file name as a string.
441
+ */
442
+ pathGetRandomFileName(alphanumeric?: boolean): string;
443
+ pathCombine(...path: Array<string>): string;
444
+ /**
445
+ * Normalizes a path.
446
+ *
447
+ * @public
448
+ * @param path The path to normalize.
449
+ * @param stripTrailing Whether to strip the trailing slash from the path.
450
+ * @returns The normalized path.
451
+ */
452
+ pathNormalize(path: string, stripTrailing?: boolean): string;
453
+ /**
454
+ * Resolves a sequence of paths into an absolute path.
455
+ *
456
+ * @public
457
+ * @param paths The paths to resolve.
458
+ * @returns The resolved absolute path.
459
+ */
460
+ pathResolve(...paths: Array<string>): string;
461
+ /**
462
+ * Checks if a path is absolute.
463
+ *
464
+ * @public
465
+ * @param path The path to check.
466
+ * @returns `true` if the path is absolute; otherwise, `false`.
467
+ */
468
+ pathIsAbsolute(path: string): boolean;
469
+ /**
470
+ * Gets the files matching a glob pattern.
471
+ *
472
+ * @public
473
+ * @param pattern The glob pattern to match.
474
+ * @param options Options for the glob operation.
475
+ * @returns An array of matching file paths.
476
+ */
477
+ pathGlob(pattern: string | Array<string>, options?: IGlobOptions): Array<string>;
478
+ /**
479
+ * Gets the relative path from one path to another.
480
+ *
481
+ * @public
482
+ * @param from The base path.
483
+ * @param to The target path.
484
+ * @returns The relative path from `from` to `to`.
485
+ */
486
+ pathRelative(from: string, to: string): string;
487
+ }
488
+ //# sourceMappingURL=FileSystem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileSystem.d.ts","sourceRoot":"","sources":["../../src/IO/FileSystem.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAK9C,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAI5E;;;;;GAKG;AACH,qBAAa,UACT,SAAQ,YAAY,CAAC,mBAAmB,CACxC,YAAW,WAAW;;IAYtB;;;;;OAKG;IACH,IAAW,aAAa,IAAI,MAAM,CAEjC;IAMD;;;;;;OAMG;IACI,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS;IAgB7E;;;;;;;OAOG;IACI,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAMxC;;;;;;;;OAQG;IACI,QAAQ,CAAC,cA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