@breadstone-infrastructure/utilities 0.0.71 → 0.0.73

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,667 @@
1
+ "use strict";
2
+ //#region Imports
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.FileSystem = void 0;
5
+ const node_stream_1 = require("node:stream");
6
+ const Path_1 = require("./Path");
7
+ const File_1 = require("./File");
8
+ const Directory_1 = require("./Directory");
9
+ const FileSystemInfo_1 = require("./FileSystemInfo");
10
+ //#endregion
11
+ /**
12
+ * Provides a complete implementation of IFileSystem using the static methods of File, Directory, and Path,
13
+ * and emits events for file and directory actions.
14
+ *
15
+ * @public
16
+ */
17
+ class FileSystem extends node_stream_1.EventEmitter {
18
+ //#region Ctor
19
+ constructor() {
20
+ super();
21
+ }
22
+ //#endregion
23
+ //#region Properties
24
+ /**
25
+ * Gets the path separator for the current platform.
26
+ *
27
+ * @public
28
+ * @returns The path separator as a string.
29
+ */
30
+ get pathSeparator() {
31
+ return Path_1.Path.separator;
32
+ }
33
+ //#endregion
34
+ //#region Methods
35
+ /**
36
+ * Checks if a file or directory exists and returns its type.
37
+ *
38
+ * @public
39
+ * @param inputPath - The path to the file or directory.
40
+ * @returns 'file' if it is a file, 'directory' if it is a directory, or 'unknown' if it does not exist or is neither.
41
+ */
42
+ isFileOrDirectory(inputPath) {
43
+ const info = new FileSystemInfo_1.FileSystemInfo(inputPath);
44
+ const isFile = info.isFile();
45
+ const isDirectory = info.isDirectory();
46
+ if (isFile) {
47
+ return 'file';
48
+ }
49
+ if (isDirectory) {
50
+ return 'directory';
51
+ }
52
+ return 'unknown';
53
+ }
54
+ /**
55
+ * Determines whether the specified file exists.
56
+ *
57
+ * @public
58
+ * @param path The file to check.
59
+ * @returns `true` if the file exists; otherwise, `false`.
60
+ * @emits fileChanged
61
+ */
62
+ fileExists(path) {
63
+ const exists = File_1.File.exists(path);
64
+ this.emit('fileChanged', path);
65
+ return exists;
66
+ }
67
+ /**
68
+ * Copies a file from one location to another.
69
+ *
70
+ * @public
71
+ * @param sourceFileName The name of the file to copy.
72
+ * @param destFileName The name of the destination file.
73
+ * @param overwrite Whether to overwrite the destination file if it exists.
74
+ * @emits fileCreated
75
+ */
76
+ fileCopy(sourceFileName, destFileName, overwrite) {
77
+ File_1.File.copy(sourceFileName, destFileName, overwrite);
78
+ this.emit('fileCreated', destFileName);
79
+ }
80
+ /**
81
+ * Reads the entire text content of a file.
82
+ *
83
+ * @public
84
+ * @param path The path to the file.
85
+ * @param encoding The encoding to use when reading the file.
86
+ * @param validateCase Whether to validate the case of the file path.
87
+ * @returns The text content of the file.
88
+ * @emits fileChanged
89
+ */
90
+ fileReadAllText(path, encoding, validateCase) {
91
+ this.emit('fileChanged', path);
92
+ return File_1.File.readAllText(path, encoding, validateCase);
93
+ }
94
+ /**
95
+ * Asynchronously reads the entire text content of a file.
96
+ *
97
+ * @public
98
+ * @param path The path to the file.
99
+ * @param encoding The encoding to use when reading the file.
100
+ * @param validateCase Whether to validate the case of the file path.
101
+ * @returns A promise that resolves with the text content of the file.
102
+ * @emits fileChanged
103
+ */
104
+ fileReadAllTextAsync(path, encoding, validateCase) {
105
+ this.emit('fileChanged', path);
106
+ return File_1.File.readAllTextAsync(path, encoding, validateCase);
107
+ }
108
+ /**
109
+ * Reads all bytes from a file.
110
+ *
111
+ * @public
112
+ * @param path The path to the file.
113
+ * @returns The content of the file as a Buffer.
114
+ * @emits fileChanged
115
+ */
116
+ fileReadAllBytes(path) {
117
+ this.emit('fileChanged', path);
118
+ return File_1.File.readAllBytes(path);
119
+ }
120
+ /**
121
+ * Asynchronously reads all bytes from a file.
122
+ *
123
+ * @public
124
+ * @param path The path to the file.
125
+ * @returns A promise that resolves with the content of the file as a Buffer.
126
+ * @emits fileChanged
127
+ */
128
+ fileReadAllBytesAsync(path) {
129
+ this.emit('fileChanged', path);
130
+ return File_1.File.readAllBytesAsync(path);
131
+ }
132
+ /**
133
+ * Writes text to a file, overwriting it if it exists.
134
+ *
135
+ * @public
136
+ * @param path The path to the file.
137
+ * @param contents The text content to write.
138
+ * @param encoding The encoding to use when writing the file.
139
+ * @param validateCase Whether to validate the case of the file path.
140
+ * @emits fileChanged
141
+ */
142
+ fileWriteAllText(path, contents, encoding, validateCase) {
143
+ File_1.File.writeAllText(path, contents, encoding, validateCase);
144
+ this.emit('fileChanged', path);
145
+ }
146
+ /**
147
+ * Asynchronously writes text to a file, overwriting it if it exists.
148
+ *
149
+ * @public
150
+ * @param path The path to the file.
151
+ * @param contents The text content to write.
152
+ * @param encoding The encoding to use when writing the file.
153
+ * @param validateCase Whether to validate the case of the file path.
154
+ * @returns A promise that resolves when the write operation is complete.
155
+ * @emits fileChanged
156
+ */
157
+ async fileWriteAllTextAsync(path, contents, encoding, validateCase) {
158
+ await File_1.File.writeAllTextAsync(path, contents, encoding, validateCase);
159
+ this.emit('fileChanged', path);
160
+ }
161
+ /**
162
+ * Writes JSON data to a file, overwriting it if it exists.
163
+ *
164
+ * @public
165
+ * @param path The path to the file.
166
+ * @param data The JSON data to write.
167
+ * @param encoding The encoding to use when writing the file.
168
+ * @emits fileChanged
169
+ */
170
+ fileWriteAllJson(path, data, encoding) {
171
+ File_1.File.writeAllJson(path, data, encoding);
172
+ this.emit('fileChanged', path);
173
+ }
174
+ /**
175
+ * Asynchronously writes JSON data to a file, overwriting it if it exists.
176
+ *
177
+ * @public
178
+ * @param path The path to the file.
179
+ * @param data The JSON data to write.
180
+ * @param encoding The encoding to use when writing the file.
181
+ * @returns A promise that resolves when the write operation is complete.
182
+ * @emits fileChanged
183
+ */
184
+ async fileWriteAllJsonAsync(path, data, encoding) {
185
+ await File_1.File.writeAllJsonAsync(path, data, encoding);
186
+ this.emit('fileChanged', path);
187
+ }
188
+ /**
189
+ * Deletes the specified file.
190
+ *
191
+ * @public
192
+ * @param path The file to delete.
193
+ * @emits fileDeleted
194
+ */
195
+ fileDelete(path) {
196
+ File_1.File.delete(path);
197
+ this.emit('fileDeleted', path);
198
+ }
199
+ /**
200
+ * Asynchronously deletes the specified file.
201
+ *
202
+ * @public
203
+ * @param path The file to delete.
204
+ * @returns A promise that resolves when the file is deleted.
205
+ * @emits fileDeleted
206
+ */
207
+ async fileDeleteAsync(path) {
208
+ await File_1.File.deleteAsync(path);
209
+ this.emit('fileDeleted', path);
210
+ }
211
+ /**
212
+ * Moves a file from one location to another.
213
+ *
214
+ * @public
215
+ * @param sourceFileName The name of the file to move.
216
+ * @param destFileName The name of the destination file.
217
+ * @emits fileDeleted
218
+ * @emits fileCreated
219
+ */
220
+ fileMove(sourceFileName, destFileName) {
221
+ File_1.File.move(sourceFileName, destFileName);
222
+ this.emit('fileDeleted', sourceFileName);
223
+ this.emit('fileCreated', destFileName);
224
+ }
225
+ /**
226
+ * Reads all JSON data from a file.
227
+ *
228
+ * @public
229
+ * @param file The file to read.
230
+ * @returns The JSON object.
231
+ * @emits fileChanged
232
+ */
233
+ fileReadAllJson(file) {
234
+ this.emit('fileChanged', file);
235
+ return File_1.File.readAllJson(file);
236
+ }
237
+ /**
238
+ * Reads all Resx entries from a file.
239
+ *
240
+ * @public
241
+ * @param file The file to read.
242
+ * @returns An array of Resx entries.
243
+ * @emits fileChanged
244
+ */
245
+ fileReadAllResx(file) {
246
+ this.emit('fileChanged', file);
247
+ return File_1.File.readAllResx(file);
248
+ }
249
+ /**
250
+ * Reads and parses an XML file.
251
+ *
252
+ * @public
253
+ * @param file The XML file to read.
254
+ * @returns The parsed XML object.
255
+ * @emits fileChanged
256
+ */
257
+ fileReadAllXml(file) {
258
+ this.emit('fileChanged', file);
259
+ return File_1.File.readAllXml(file);
260
+ }
261
+ /**
262
+ * Creates a hash from a file.
263
+ *
264
+ * @public
265
+ * @param file The file to hash.
266
+ * @param algorithm The hashing algorithm to use (default is 'sha1').
267
+ * @param encoding The encoding of the hash (default is 'hex').
268
+ * @returns A promise that resolves with the hash as a string or Buffer.
269
+ * @emits fileChanged
270
+ */
271
+ fileHash(file, algorithm, encoding) {
272
+ this.emit('fileChanged', file);
273
+ return File_1.File.hash(file, algorithm, encoding);
274
+ }
275
+ /**
276
+ * Gets a list of files matching the specified glob pattern.
277
+ *
278
+ * @public
279
+ * @param pattern The glob pattern to match files against.
280
+ * @returns An array of matching file paths.
281
+ */
282
+ fileGlob(pattern) {
283
+ return File_1.File.glob(pattern);
284
+ }
285
+ /**
286
+ * Gets the locale from a file.
287
+ *
288
+ * @public
289
+ * @param file The file to read the locale from.
290
+ * @param defaultLocale The default locale to return if none is found.
291
+ * @returns The locale string.
292
+ */
293
+ fileGetLocale(file, defaultLocale) {
294
+ return File_1.File.getLocale(file, defaultLocale);
295
+ }
296
+ /**
297
+ * Gets the size of a file.
298
+ *
299
+ * @public
300
+ * @param file The file to check.
301
+ * @returns The size of the file in bytes.
302
+ */
303
+ fileSize(file) {
304
+ return File_1.File.size(file);
305
+ }
306
+ /**
307
+ * Creates a symbolic link.
308
+ *
309
+ * @public
310
+ * @param src The source file.
311
+ * @param dest The destination link.
312
+ * @param symbolicLink The symbolic link options.
313
+ * @emits fileCreated
314
+ */
315
+ fileCreateSymbolicLink(src, dest, symbolicLink) {
316
+ File_1.File.createSymbolicLink(src, dest, symbolicLink);
317
+ this.emit('fileCreated', dest);
318
+ }
319
+ /**
320
+ * Creates a directory.
321
+ *
322
+ * @public
323
+ * @param path The directory to create.
324
+ * @emits directoryCreated
325
+ */
326
+ directoryCreate(path) {
327
+ Directory_1.Directory.create(path);
328
+ this.emit('directoryCreated', path);
329
+ }
330
+ /**
331
+ * Asynchronously creates a directory.
332
+ *
333
+ * @public
334
+ * @param path The directory to create.
335
+ * @returns A promise that resolves when the directory is created.
336
+ * @emits directoryCreated
337
+ */
338
+ directoryCreateAsync(path) {
339
+ return Directory_1.Directory.createAsync(path).then(() => {
340
+ this.emit('directoryCreated', path);
341
+ });
342
+ }
343
+ /**
344
+ * Deletes an directory.
345
+ *
346
+ * @public
347
+ * @param path The directory to delete.
348
+ * @emits directoryDeleted
349
+ */
350
+ directoryDelete(path) {
351
+ Directory_1.Directory.delete(path);
352
+ this.emit('directoryDeleted', path);
353
+ }
354
+ /**
355
+ * Asynchronously deletes an directory.
356
+ *
357
+ * @public
358
+ * @param path The directory to delete.
359
+ * @returns A promise that resolves when the directory is deleted.
360
+ * @emits directoryDeleted
361
+ */
362
+ directoryDeleteAsync(path) {
363
+ return new Promise((resolve, reject) => {
364
+ try {
365
+ Directory_1.Directory.delete(path);
366
+ this.emit('directoryDeleted', path);
367
+ resolve();
368
+ }
369
+ catch (err) {
370
+ this.emit('error', err);
371
+ reject(err);
372
+ }
373
+ });
374
+ }
375
+ /**
376
+ * Checks if a directory exists.
377
+ *
378
+ * @public
379
+ * @param path The path to the directory.
380
+ * @returns `true` if the directory exists; otherwise, `false`.
381
+ * @emits directoryChanged
382
+ */
383
+ directoryExists(path) {
384
+ const exists = Directory_1.Directory.exists(path);
385
+ this.emit('directoryChanged', path);
386
+ return exists;
387
+ }
388
+ /**
389
+ * Asynchronously checks if a directory exists.
390
+ *
391
+ * @public
392
+ * @param path The path to the directory.
393
+ * @returns A promise that resolves to `true` if the directory exists; otherwise, `false`.
394
+ * @emits directoryChanged
395
+ */
396
+ directoryExistsAsync(path) {
397
+ const exists = Directory_1.Directory.exists(path);
398
+ this.emit('directoryChanged', path);
399
+ return Promise.resolve(exists);
400
+ }
401
+ /**
402
+ * Counts the number of files and directories in a directory.
403
+ *
404
+ * @public
405
+ * @param path The directory path.
406
+ * @returns The number of files and directories.
407
+ */
408
+ directoryCount(path) {
409
+ return Directory_1.Directory.count(path);
410
+ }
411
+ /**
412
+ * Asynchronously counts the number of files and directories in a directory.
413
+ *
414
+ * @public
415
+ * @param path The directory path.
416
+ * @returns A promise that resolves to the number of files and directories.
417
+ */
418
+ directoryCountAsync(path) {
419
+ return Promise.resolve(Directory_1.Directory.count(path));
420
+ }
421
+ /**
422
+ * Gets the size of a directory.
423
+ *
424
+ * @public
425
+ * @param path The directory path.
426
+ * @returns The size of the directory in bytes.
427
+ */
428
+ directorySize(path) {
429
+ return Directory_1.Directory.size(path);
430
+ }
431
+ /**
432
+ * Asynchronously gets the size of a directory.
433
+ *
434
+ * @public
435
+ * @param path The directory path.
436
+ * @returns A promise that resolves to the size of the directory in bytes.
437
+ */
438
+ directorySizeAsync(path) {
439
+ return Promise.resolve(Directory_1.Directory.size(path));
440
+ }
441
+ /**
442
+ * Retrieves the parent directory of the specified path.
443
+ *
444
+ * @public
445
+ * @param path The path for which to retrieve the parent directory.
446
+ * @returns The parent directory path or null if not available.
447
+ */
448
+ directoryGetParent(path) {
449
+ return Directory_1.Directory.getParent(path);
450
+ }
451
+ /**
452
+ * Asynchronously retrieves the parent directory of the specified path.
453
+ *
454
+ * @public
455
+ * @param path The path for which to retrieve the parent directory.
456
+ * @returns A promise that resolves to the parent directory path or null if not available.
457
+ */
458
+ directoryGetParentAsync(path) {
459
+ return Promise.resolve(Directory_1.Directory.getParent(path));
460
+ }
461
+ /**
462
+ * Lists all files in a directory recursively in a synchronous fashion.
463
+ *
464
+ * @public
465
+ * @param path The root directory path.
466
+ * @returns An iterable iterator of file paths.
467
+ */
468
+ directoryWalk(path) {
469
+ return Directory_1.Directory.walk(path);
470
+ }
471
+ /**
472
+ * Lists all files in a directory recursively in an asynchronous fashion.
473
+ *
474
+ * @public
475
+ * @param path The root directory path.
476
+ * @returns An async iterable iterator of file paths.
477
+ */
478
+ async *directoryWalkAsync(path) {
479
+ for (const entry of Directory_1.Directory.walk(path)) {
480
+ yield entry;
481
+ }
482
+ }
483
+ /**
484
+ * Finds directories using glob patterns.
485
+ *
486
+ * @public
487
+ * @param pattern The globbing pattern(s).
488
+ * @returns An array of directory paths.
489
+ */
490
+ directoryGlob(pattern) {
491
+ return Directory_1.Directory.glob(pattern);
492
+ }
493
+ /**
494
+ * Asynchronously finds directories using glob patterns.
495
+ *
496
+ * @public
497
+ * @param pattern The globbing pattern(s).
498
+ * @returns A promise that resolves to an array of directory paths.
499
+ */
500
+ directoryGlobAsync(pattern) {
501
+ return Promise.resolve(Directory_1.Directory.glob(pattern));
502
+ }
503
+ /**
504
+ * Copies a directory to a new location.
505
+ *
506
+ * @public
507
+ * @param sourcePath The source directory path.
508
+ * @param targetPath The target directory path.
509
+ * @emits directoryCreated
510
+ */
511
+ directoryCopy(sourcePath, targetPath) {
512
+ Directory_1.Directory.copy(sourcePath, targetPath);
513
+ this.emit('directoryCreated', targetPath);
514
+ }
515
+ /**
516
+ * Asynchronously copies a directory to a new location.
517
+ *
518
+ * @public
519
+ * @param sourcePath The source directory path.
520
+ * @param targetPath The target directory path.
521
+ * @returns A promise that resolves when the copy operation is complete.
522
+ * @emits directoryCreated
523
+ */
524
+ directoryCopyAsync(sourcePath, targetPath) {
525
+ return new Promise((resolve, reject) => {
526
+ try {
527
+ Directory_1.Directory.copy(sourcePath, targetPath);
528
+ this.emit('directoryCreated', targetPath);
529
+ resolve();
530
+ }
531
+ catch (err) {
532
+ this.emit('error', err);
533
+ reject(err);
534
+ }
535
+ });
536
+ }
537
+ /**
538
+ * Changes the extension of a path.
539
+ *
540
+ * @public
541
+ * @param path The original path.
542
+ * @param extension The new extension to set.
543
+ * @returns The path with the new extension.
544
+ */
545
+ pathChangeExtension(path, extension) {
546
+ return Path_1.Path.changeExtension(path, extension);
547
+ }
548
+ /**
549
+ * Gets the directory name of a path.
550
+ *
551
+ * @public
552
+ * @param path The path to get the directory name from.
553
+ * @returns The directory name of the path.
554
+ */
555
+ pathGetDirectoryName(path) {
556
+ return Path_1.Path.getDirectoryName(path);
557
+ }
558
+ /**
559
+ * Gets the directory segments of a path.
560
+ *
561
+ * @public
562
+ * @param path The path to get the directory segments from.
563
+ * @returns An array of directory segments.
564
+ */
565
+ pathGetDirectorySegments(path) {
566
+ return Path_1.Path.getDirectorySegments(path);
567
+ }
568
+ /**
569
+ * Gets the file name of a path.
570
+ *
571
+ * @public
572
+ * @param path The path to get the file name from.
573
+ * @returns The file name of the path.
574
+ */
575
+ pathGetFileName(path) {
576
+ return Path_1.Path.getFileName(path);
577
+ }
578
+ /**
579
+ * Gets the file name without extension from a path.
580
+ *
581
+ * @public
582
+ * @param path The path to get the file name without extension from.
583
+ * @returns The file name without extension.
584
+ */
585
+ pathGetFileNameWithoutExtension(path) {
586
+ return Path_1.Path.getFileNameWithoutExtension(path);
587
+ }
588
+ /**
589
+ * Gets the extension of a path.
590
+ *
591
+ * @public
592
+ * @param path The path to get the extension from.
593
+ * @param includeDot Whether to include the dot in the extension.
594
+ * @returns The extension of the path.
595
+ */
596
+ pathGetExtension(path, includeDot) {
597
+ return Path_1.Path.getExtension(path, includeDot);
598
+ }
599
+ /**
600
+ * Gets a random file name.
601
+ *
602
+ * @public
603
+ * @param alphanumeric Whether to use alphanumeric characters in the file name.
604
+ * @returns A random file name as a string.
605
+ */
606
+ pathGetRandomFileName(alphanumeric) {
607
+ return Path_1.Path.getRandomFileName(alphanumeric);
608
+ }
609
+ pathCombine(...path) {
610
+ return Path_1.Path.combine(...path);
611
+ }
612
+ /**
613
+ * Normalizes a path.
614
+ *
615
+ * @public
616
+ * @param path The path to normalize.
617
+ * @param stripTrailing Whether to strip the trailing slash from the path.
618
+ * @returns The normalized path.
619
+ */
620
+ pathNormalize(path, stripTrailing) {
621
+ return Path_1.Path.normalize(path, stripTrailing);
622
+ }
623
+ /**
624
+ * Resolves a sequence of paths into an absolute path.
625
+ *
626
+ * @public
627
+ * @param paths The paths to resolve.
628
+ * @returns The resolved absolute path.
629
+ */
630
+ pathResolve(...paths) {
631
+ return Path_1.Path.resolve(...paths);
632
+ }
633
+ /**
634
+ * Checks if a path is absolute.
635
+ *
636
+ * @public
637
+ * @param path The path to check.
638
+ * @returns `true` if the path is absolute; otherwise, `false`.
639
+ */
640
+ pathIsAbsolute(path) {
641
+ return Path_1.Path.isAbsolute(path);
642
+ }
643
+ /**
644
+ * Gets the files matching a glob pattern.
645
+ *
646
+ * @public
647
+ * @param pattern The glob pattern to match.
648
+ * @param options Options for the glob operation.
649
+ * @returns An array of matching file paths.
650
+ */
651
+ pathGlob(pattern, options) {
652
+ return Path_1.Path.glob(pattern, options);
653
+ }
654
+ /**
655
+ * Gets the relative path from one path to another.
656
+ *
657
+ * @public
658
+ * @param from The base path.
659
+ * @param to The target path.
660
+ * @returns The relative path from `from` to `to`.
661
+ */
662
+ pathRelative(from, to) {
663
+ return Path_1.Path.relative(from, to);
664
+ }
665
+ }
666
+ exports.FileSystem = FileSystem;
667
+ //# sourceMappingURL=FileSystem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileSystem.js","sourceRoot":"","sources":["../../src/IO/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