@bemoje/fs 0.2.11 → 0.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/LICENSE +21 -0
- package/README.md +2 -2
- package/cjs/index.d.ts +80 -0
- package/cjs/index.d.ts.map +1 -0
- package/cjs/index.js +83 -0
- package/cjs/index.js.map +1 -0
- package/cjs/lib/appendFile.d.ts +10 -0
- package/cjs/lib/appendFile.d.ts.map +1 -0
- package/cjs/lib/appendFile.js +23 -0
- package/cjs/lib/appendFile.js.map +1 -0
- package/cjs/lib/appendFileLine.d.ts +7 -0
- package/cjs/lib/appendFileLine.d.ts.map +1 -0
- package/cjs/lib/appendFileLine.js +16 -0
- package/cjs/lib/appendFileLine.js.map +1 -0
- package/cjs/lib/appendFileLineSync.d.ts +7 -0
- package/cjs/lib/appendFileLineSync.d.ts.map +1 -0
- package/cjs/lib/appendFileLineSync.js +16 -0
- package/cjs/lib/appendFileLineSync.js.map +1 -0
- package/cjs/lib/appendFileSync.d.ts +10 -0
- package/cjs/lib/appendFileSync.d.ts.map +1 -0
- package/cjs/lib/appendFileSync.js +23 -0
- package/cjs/lib/appendFileSync.js.map +1 -0
- package/{src → cjs}/lib/createDirectory.d.ts +1 -5
- package/cjs/lib/createDirectory.d.ts.map +1 -0
- package/cjs/lib/createDirectory.js +18 -0
- package/cjs/lib/createDirectory.js.map +1 -0
- package/{src → cjs}/lib/createDirectorySync.d.ts +1 -3
- package/cjs/lib/createDirectorySync.d.ts.map +1 -0
- package/{src → cjs}/lib/createDirectorySync.js +2 -5
- package/cjs/lib/createDirectorySync.js.map +1 -0
- package/cjs/lib/emptyDirectory.d.ts +17 -0
- package/cjs/lib/emptyDirectory.d.ts.map +1 -0
- package/cjs/lib/emptyDirectory.js +26 -0
- package/cjs/lib/emptyDirectory.js.map +1 -0
- package/cjs/lib/emptyDirectorySync.d.ts +17 -0
- package/cjs/lib/emptyDirectorySync.d.ts.map +1 -0
- package/cjs/lib/emptyDirectorySync.js +29 -0
- package/cjs/lib/emptyDirectorySync.js.map +1 -0
- package/{src → cjs}/lib/getJsonIndentation.d.ts +1 -0
- package/cjs/lib/getJsonIndentation.d.ts.map +1 -0
- package/{src → cjs}/lib/getJsonIndentation.js +2 -2
- package/{src → cjs}/lib/getJsonIndentation.js.map +1 -1
- package/{src → cjs}/lib/getLastMofifiedFileIn.d.ts +1 -0
- package/cjs/lib/getLastMofifiedFileIn.d.ts.map +1 -0
- package/cjs/lib/getLastMofifiedFileIn.js +20 -0
- package/cjs/lib/getLastMofifiedFileIn.js.map +1 -0
- package/cjs/lib/promptUserEditInTextEditor.d.ts +10 -0
- package/cjs/lib/promptUserEditInTextEditor.d.ts.map +1 -0
- package/cjs/lib/promptUserEditInTextEditor.js +29 -0
- package/cjs/lib/promptUserEditInTextEditor.js.map +1 -0
- package/cjs/lib/promptUserEditInTextEditorSync.d.ts +10 -0
- package/cjs/lib/promptUserEditInTextEditorSync.d.ts.map +1 -0
- package/cjs/lib/promptUserEditInTextEditorSync.js +27 -0
- package/cjs/lib/promptUserEditInTextEditorSync.js.map +1 -0
- package/cjs/lib/promptUserEditJsonInTextEditor.d.ts +13 -0
- package/cjs/lib/promptUserEditJsonInTextEditor.d.ts.map +1 -0
- package/cjs/lib/promptUserEditJsonInTextEditor.js +25 -0
- package/cjs/lib/promptUserEditJsonInTextEditor.js.map +1 -0
- package/cjs/lib/promptUserEditJsonInTextEditorSync.d.ts +13 -0
- package/cjs/lib/promptUserEditJsonInTextEditorSync.d.ts.map +1 -0
- package/cjs/lib/promptUserEditJsonInTextEditorSync.js +25 -0
- package/cjs/lib/promptUserEditJsonInTextEditorSync.js.map +1 -0
- package/cjs/lib/readDirectoryDirents.d.ts +11 -0
- package/cjs/lib/readDirectoryDirents.d.ts.map +1 -0
- package/cjs/lib/readDirectoryDirents.js +17 -0
- package/cjs/lib/readDirectoryDirents.js.map +1 -0
- package/cjs/lib/readDirectoryDirentsPaths.d.ts +14 -0
- package/cjs/lib/readDirectoryDirentsPaths.d.ts.map +1 -0
- package/cjs/lib/readDirectoryDirentsPaths.js +27 -0
- package/cjs/lib/readDirectoryDirentsPaths.js.map +1 -0
- package/cjs/lib/readDirectoryDirentsPathsSafe.d.ts +15 -0
- package/cjs/lib/readDirectoryDirentsPathsSafe.d.ts.map +1 -0
- package/cjs/lib/readDirectoryDirentsPathsSafe.js +22 -0
- package/cjs/lib/readDirectoryDirentsPathsSafe.js.map +1 -0
- package/cjs/lib/readDirectoryDirentsPathsSafeSync.d.ts +15 -0
- package/cjs/lib/readDirectoryDirentsPathsSafeSync.d.ts.map +1 -0
- package/cjs/lib/readDirectoryDirentsPathsSafeSync.js +22 -0
- package/cjs/lib/readDirectoryDirentsPathsSafeSync.js.map +1 -0
- package/cjs/lib/readDirectoryDirentsPathsSync.d.ts +14 -0
- package/cjs/lib/readDirectoryDirentsPathsSync.d.ts.map +1 -0
- package/cjs/lib/readDirectoryDirentsPathsSync.js +27 -0
- package/cjs/lib/readDirectoryDirentsPathsSync.js.map +1 -0
- package/cjs/lib/readDirectoryDirentsSafe.d.ts +12 -0
- package/cjs/lib/readDirectoryDirentsSafe.d.ts.map +1 -0
- package/cjs/lib/readDirectoryDirentsSafe.js +20 -0
- package/cjs/lib/readDirectoryDirentsSafe.js.map +1 -0
- package/cjs/lib/readDirectoryDirentsSafeSync.d.ts +12 -0
- package/cjs/lib/readDirectoryDirentsSafeSync.d.ts.map +1 -0
- package/cjs/lib/readDirectoryDirentsSafeSync.js +20 -0
- package/cjs/lib/readDirectoryDirentsSafeSync.js.map +1 -0
- package/cjs/lib/readDirectoryDirentsSync.d.ts +11 -0
- package/cjs/lib/readDirectoryDirentsSync.d.ts.map +1 -0
- package/cjs/lib/readDirectoryDirentsSync.js +17 -0
- package/cjs/lib/readDirectoryDirentsSync.js.map +1 -0
- package/cjs/lib/readDirectoryNames.d.ts +7 -0
- package/cjs/lib/readDirectoryNames.d.ts.map +1 -0
- package/cjs/lib/readDirectoryNames.js +15 -0
- package/cjs/lib/readDirectoryNames.js.map +1 -0
- package/cjs/lib/readDirectoryNamesPaths.d.ts +11 -0
- package/cjs/lib/readDirectoryNamesPaths.d.ts.map +1 -0
- package/cjs/lib/readDirectoryNamesPaths.js +24 -0
- package/cjs/lib/readDirectoryNamesPaths.js.map +1 -0
- package/cjs/lib/readDirectoryNamesPathsSafe.d.ts +12 -0
- package/cjs/lib/readDirectoryNamesPathsSafe.d.ts.map +1 -0
- package/cjs/lib/readDirectoryNamesPathsSafe.js +20 -0
- package/cjs/lib/readDirectoryNamesPathsSafe.js.map +1 -0
- package/cjs/lib/readDirectoryNamesPathsSafeSync.d.ts +12 -0
- package/cjs/lib/readDirectoryNamesPathsSafeSync.d.ts.map +1 -0
- package/cjs/lib/readDirectoryNamesPathsSafeSync.js +20 -0
- package/cjs/lib/readDirectoryNamesPathsSafeSync.js.map +1 -0
- package/cjs/lib/readDirectoryNamesPathsSync.d.ts +11 -0
- package/cjs/lib/readDirectoryNamesPathsSync.d.ts.map +1 -0
- package/cjs/lib/readDirectoryNamesPathsSync.js +24 -0
- package/cjs/lib/readDirectoryNamesPathsSync.js.map +1 -0
- package/cjs/lib/readDirectoryNamesSafe.d.ts +8 -0
- package/cjs/lib/readDirectoryNamesSafe.d.ts.map +1 -0
- package/cjs/lib/readDirectoryNamesSafe.js +18 -0
- package/cjs/lib/readDirectoryNamesSafe.js.map +1 -0
- package/cjs/lib/readDirectoryNamesSafeSync.d.ts +8 -0
- package/cjs/lib/readDirectoryNamesSafeSync.d.ts.map +1 -0
- package/cjs/lib/readDirectoryNamesSafeSync.js +18 -0
- package/cjs/lib/readDirectoryNamesSafeSync.js.map +1 -0
- package/cjs/lib/readDirectoryNamesSync.d.ts +7 -0
- package/cjs/lib/readDirectoryNamesSync.d.ts.map +1 -0
- package/cjs/lib/readDirectoryNamesSync.js +15 -0
- package/cjs/lib/readDirectoryNamesSync.js.map +1 -0
- package/cjs/lib/readDirectoryPaths.d.ts +7 -0
- package/cjs/lib/readDirectoryPaths.d.ts.map +1 -0
- package/cjs/lib/readDirectoryPaths.js +18 -0
- package/cjs/lib/readDirectoryPaths.js.map +1 -0
- package/cjs/lib/readDirectoryPathsSafe.d.ts +8 -0
- package/cjs/lib/readDirectoryPathsSafe.d.ts.map +1 -0
- package/cjs/lib/readDirectoryPathsSafe.js +19 -0
- package/cjs/lib/readDirectoryPathsSafe.js.map +1 -0
- package/cjs/lib/readDirectoryPathsSafeSync.d.ts +8 -0
- package/cjs/lib/readDirectoryPathsSafeSync.d.ts.map +1 -0
- package/cjs/lib/readDirectoryPathsSafeSync.js +19 -0
- package/cjs/lib/readDirectoryPathsSafeSync.js.map +1 -0
- package/cjs/lib/readDirectoryPathsSync.d.ts +7 -0
- package/cjs/lib/readDirectoryPathsSync.d.ts.map +1 -0
- package/cjs/lib/readDirectoryPathsSync.js +18 -0
- package/cjs/lib/readDirectoryPathsSync.js.map +1 -0
- package/cjs/lib/readDirectoryStats.d.ts +13 -0
- package/cjs/lib/readDirectoryStats.d.ts.map +1 -0
- package/cjs/lib/readDirectoryStats.js +33 -0
- package/cjs/lib/readDirectoryStats.js.map +1 -0
- package/cjs/lib/readDirectoryStatsSafe.d.ts +14 -0
- package/cjs/lib/readDirectoryStatsSafe.d.ts.map +1 -0
- package/cjs/lib/readDirectoryStatsSafe.js +20 -0
- package/cjs/lib/readDirectoryStatsSafe.js.map +1 -0
- package/cjs/lib/readDirectoryStatsSafeSync.d.ts +14 -0
- package/cjs/lib/readDirectoryStatsSafeSync.d.ts.map +1 -0
- package/cjs/lib/readDirectoryStatsSafeSync.js +20 -0
- package/cjs/lib/readDirectoryStatsSafeSync.js.map +1 -0
- package/cjs/lib/readDirectoryStatsSync.d.ts +13 -0
- package/cjs/lib/readDirectoryStatsSync.d.ts.map +1 -0
- package/cjs/lib/readDirectoryStatsSync.js +32 -0
- package/cjs/lib/readDirectoryStatsSync.js.map +1 -0
- package/cjs/lib/readFile.d.ts +22 -0
- package/cjs/lib/readFile.d.ts.map +1 -0
- package/cjs/lib/readFile.js +21 -0
- package/cjs/lib/readFile.js.map +1 -0
- package/cjs/lib/readFileBuffer.d.ts +20 -0
- package/cjs/lib/readFileBuffer.d.ts.map +1 -0
- package/cjs/lib/readFileBuffer.js +20 -0
- package/cjs/lib/readFileBuffer.js.map +1 -0
- package/cjs/lib/readFileBufferSafe.d.ts +12 -0
- package/cjs/lib/readFileBufferSafe.d.ts.map +1 -0
- package/cjs/lib/readFileBufferSafe.js +24 -0
- package/cjs/lib/readFileBufferSafe.js.map +1 -0
- package/cjs/lib/readFileBufferSafeSync.d.ts +12 -0
- package/cjs/lib/readFileBufferSafeSync.d.ts.map +1 -0
- package/cjs/lib/readFileBufferSafeSync.js +24 -0
- package/cjs/lib/readFileBufferSafeSync.js.map +1 -0
- package/cjs/lib/readFileBufferSync.d.ts +10 -0
- package/cjs/lib/readFileBufferSync.d.ts.map +1 -0
- package/cjs/lib/readFileBufferSync.js +17 -0
- package/cjs/lib/readFileBufferSync.js.map +1 -0
- package/cjs/lib/readFileSafe.d.ts +14 -0
- package/cjs/lib/readFileSafe.d.ts.map +1 -0
- package/cjs/lib/readFileSafe.js +26 -0
- package/cjs/lib/readFileSafe.js.map +1 -0
- package/cjs/lib/readFileSafeSync.d.ts +14 -0
- package/cjs/lib/readFileSafeSync.d.ts.map +1 -0
- package/cjs/lib/readFileSafeSync.js +26 -0
- package/cjs/lib/readFileSafeSync.js.map +1 -0
- package/cjs/lib/readFileSync.d.ts +11 -0
- package/cjs/lib/readFileSync.d.ts.map +1 -0
- package/cjs/lib/readFileSync.js +18 -0
- package/cjs/lib/readFileSync.js.map +1 -0
- package/cjs/lib/readJsonFile.d.ts +2 -0
- package/cjs/lib/readJsonFile.d.ts.map +1 -0
- package/cjs/lib/readJsonFile.js +6 -0
- package/cjs/lib/readJsonFile.js.map +1 -0
- package/cjs/lib/readJsonFileSafe.d.ts +10 -0
- package/cjs/lib/readJsonFileSafe.d.ts.map +1 -0
- package/cjs/lib/readJsonFileSafe.js +22 -0
- package/cjs/lib/readJsonFileSafe.js.map +1 -0
- package/cjs/lib/readJsonFileSafeSync.d.ts +10 -0
- package/cjs/lib/readJsonFileSafeSync.d.ts.map +1 -0
- package/cjs/lib/readJsonFileSafeSync.js +22 -0
- package/cjs/lib/readJsonFileSafeSync.js.map +1 -0
- package/cjs/lib/readJsonFileSync.d.ts +2 -0
- package/cjs/lib/readJsonFileSync.d.ts.map +1 -0
- package/cjs/lib/readJsonFileSync.js +6 -0
- package/cjs/lib/readJsonFileSync.js.map +1 -0
- package/cjs/lib/removeDirectory.d.ts +2 -0
- package/cjs/lib/removeDirectory.d.ts.map +1 -0
- package/cjs/lib/removeDirectory.js +6 -0
- package/cjs/lib/removeDirectory.js.map +1 -0
- package/cjs/lib/removeDirectorySync.d.ts +2 -0
- package/cjs/lib/removeDirectorySync.d.ts.map +1 -0
- package/cjs/lib/removeDirectorySync.js +6 -0
- package/cjs/lib/removeDirectorySync.js.map +1 -0
- package/cjs/lib/removeFile.d.ts +2 -0
- package/cjs/lib/removeFile.d.ts.map +1 -0
- package/cjs/lib/removeFile.js +6 -0
- package/cjs/lib/removeFile.js.map +1 -0
- package/cjs/lib/removeFileSync.d.ts +2 -0
- package/cjs/lib/removeFileSync.d.ts.map +1 -0
- package/cjs/lib/removeFileSync.js +6 -0
- package/cjs/lib/removeFileSync.js.map +1 -0
- package/{src → cjs}/lib/tempFile.d.ts +3 -2
- package/cjs/lib/tempFile.d.ts.map +1 -0
- package/cjs/lib/tempFile.js +27 -0
- package/cjs/lib/tempFile.js.map +1 -0
- package/cjs/lib/tempFileSync.d.ts +7 -0
- package/cjs/lib/tempFileSync.d.ts.map +1 -0
- package/cjs/lib/tempFileSync.js +27 -0
- package/cjs/lib/tempFileSync.js.map +1 -0
- package/cjs/lib/types/IGetUserInputFromEditorOptions.d.ts +16 -0
- package/cjs/lib/types/IGetUserInputFromEditorOptions.d.ts.map +1 -0
- package/{src/lib/types/IEnsureValidWindowsPathOptions.js → cjs/lib/types/IGetUserInputFromEditorOptions.js} +1 -1
- package/cjs/lib/types/IGetUserInputFromEditorOptions.js.map +1 -0
- package/cjs/lib/types/IJFReadOptions.d.ts +2 -0
- package/cjs/lib/types/IJFReadOptions.d.ts.map +1 -0
- package/cjs/lib/types/IJFReadOptions.js +3 -0
- package/cjs/lib/types/IJFReadOptions.js.map +1 -0
- package/cjs/lib/types/IJFWriteOptions.d.ts +2 -0
- package/cjs/lib/types/IJFWriteOptions.d.ts.map +1 -0
- package/cjs/lib/types/IJFWriteOptions.js +3 -0
- package/cjs/lib/types/IJFWriteOptions.js.map +1 -0
- package/cjs/lib/types/IJsonOutputOptions.d.ts +2 -0
- package/cjs/lib/types/IJsonOutputOptions.d.ts.map +1 -0
- package/cjs/lib/types/IJsonOutputOptions.js +3 -0
- package/cjs/lib/types/IJsonOutputOptions.js.map +1 -0
- package/{src → cjs}/lib/types/ILogFileData.d.ts +1 -0
- package/cjs/lib/types/ILogFileData.d.ts.map +1 -0
- package/cjs/lib/types/IReadJsonFileOptions.d.ts +2 -0
- package/cjs/lib/types/IReadJsonFileOptions.d.ts.map +1 -0
- package/cjs/lib/types/IReadJsonFileOptions.js +3 -0
- package/cjs/lib/types/IReadJsonFileOptions.js.map +1 -0
- package/cjs/lib/types/JsonReplacerReviver.d.ts +2 -0
- package/cjs/lib/types/JsonReplacerReviver.d.ts.map +1 -0
- package/cjs/lib/types/JsonReplacerReviver.js +3 -0
- package/cjs/lib/types/JsonReplacerReviver.js.map +1 -0
- package/cjs/lib/updateFile.d.ts +11 -0
- package/cjs/lib/updateFile.d.ts.map +1 -0
- package/cjs/lib/updateFile.js +20 -0
- package/cjs/lib/updateFile.js.map +1 -0
- package/cjs/lib/updateFileSafe.d.ts +13 -0
- package/cjs/lib/updateFileSafe.d.ts.map +1 -0
- package/cjs/lib/updateFileSafe.js +28 -0
- package/cjs/lib/updateFileSafe.js.map +1 -0
- package/cjs/lib/updateFileSafeSync.d.ts +13 -0
- package/cjs/lib/updateFileSafeSync.d.ts.map +1 -0
- package/cjs/lib/updateFileSafeSync.js +28 -0
- package/cjs/lib/updateFileSafeSync.js.map +1 -0
- package/cjs/lib/updateFileSync.d.ts +11 -0
- package/cjs/lib/updateFileSync.d.ts.map +1 -0
- package/cjs/lib/updateFileSync.js +20 -0
- package/cjs/lib/updateFileSync.js.map +1 -0
- package/cjs/lib/updateJsonFile.d.ts +15 -0
- package/cjs/lib/updateJsonFile.d.ts.map +1 -0
- package/cjs/lib/updateJsonFile.js +20 -0
- package/cjs/lib/updateJsonFile.js.map +1 -0
- package/cjs/lib/updateJsonFileSafe.d.ts +17 -0
- package/cjs/lib/updateJsonFileSafe.d.ts.map +1 -0
- package/cjs/lib/updateJsonFileSafe.js +28 -0
- package/cjs/lib/updateJsonFileSafe.js.map +1 -0
- package/cjs/lib/updateJsonFileSafeSync.d.ts +17 -0
- package/cjs/lib/updateJsonFileSafeSync.d.ts.map +1 -0
- package/cjs/lib/updateJsonFileSafeSync.js +28 -0
- package/cjs/lib/updateJsonFileSafeSync.js.map +1 -0
- package/cjs/lib/updateJsonFileSync.d.ts +15 -0
- package/cjs/lib/updateJsonFileSync.d.ts.map +1 -0
- package/cjs/lib/updateJsonFileSync.js +20 -0
- package/cjs/lib/updateJsonFileSync.js.map +1 -0
- package/cjs/lib/writeFile.d.ts +2 -0
- package/cjs/lib/writeFile.d.ts.map +1 -0
- package/cjs/lib/writeFile.js +6 -0
- package/cjs/lib/writeFile.js.map +1 -0
- package/cjs/lib/writeFileSafe.d.ts +2 -0
- package/cjs/lib/writeFileSafe.d.ts.map +1 -0
- package/cjs/lib/writeFileSafe.js +6 -0
- package/cjs/lib/writeFileSafe.js.map +1 -0
- package/cjs/lib/writeFileSafeSync.d.ts +2 -0
- package/cjs/lib/writeFileSafeSync.d.ts.map +1 -0
- package/cjs/lib/writeFileSafeSync.js +6 -0
- package/cjs/lib/writeFileSafeSync.js.map +1 -0
- package/cjs/lib/writeFileSync.d.ts +2 -0
- package/cjs/lib/writeFileSync.d.ts.map +1 -0
- package/cjs/lib/writeFileSync.js +6 -0
- package/cjs/lib/writeFileSync.js.map +1 -0
- package/cjs/lib/writeJsonFile.d.ts +2 -0
- package/cjs/lib/writeJsonFile.d.ts.map +1 -0
- package/cjs/lib/writeJsonFile.js +6 -0
- package/cjs/lib/writeJsonFile.js.map +1 -0
- package/cjs/lib/writeJsonFileSafe.d.ts +2 -0
- package/cjs/lib/writeJsonFileSafe.d.ts.map +1 -0
- package/cjs/lib/writeJsonFileSafe.js +6 -0
- package/cjs/lib/writeJsonFileSafe.js.map +1 -0
- package/cjs/lib/writeJsonFileSafeSync.d.ts +2 -0
- package/cjs/lib/writeJsonFileSafeSync.d.ts.map +1 -0
- package/cjs/lib/writeJsonFileSafeSync.js +6 -0
- package/cjs/lib/writeJsonFileSafeSync.js.map +1 -0
- package/cjs/lib/writeJsonFileSync.d.ts +2 -0
- package/cjs/lib/writeJsonFileSync.d.ts.map +1 -0
- package/cjs/lib/writeJsonFileSync.js +6 -0
- package/cjs/lib/writeJsonFileSync.js.map +1 -0
- package/package.json +11 -16
- package/src/index.d.ts +0 -35
- package/src/index.js +0 -39
- package/src/index.js.map +0 -1
- package/src/lib/AppData.d.ts +0 -10
- package/src/lib/AppData.js +0 -24
- package/src/lib/AppData.js.map +0 -1
- package/src/lib/JsonFile.d.ts +0 -78
- package/src/lib/JsonFile.js +0 -158
- package/src/lib/JsonFile.js.map +0 -1
- package/src/lib/LogFile.d.ts +0 -50
- package/src/lib/LogFile.js +0 -158
- package/src/lib/LogFile.js.map +0 -1
- package/src/lib/absoluteToRelativePath.d.ts +0 -13
- package/src/lib/absoluteToRelativePath.js +0 -25
- package/src/lib/absoluteToRelativePath.js.map +0 -1
- package/src/lib/appendLineToFile.d.ts +0 -11
- package/src/lib/appendLineToFile.js +0 -28
- package/src/lib/appendLineToFile.js.map +0 -1
- package/src/lib/cleanDirectorySync.d.ts +0 -16
- package/src/lib/cleanDirectorySync.js +0 -29
- package/src/lib/cleanDirectorySync.js.map +0 -1
- package/src/lib/createDirectory.js +0 -25
- package/src/lib/createDirectory.js.map +0 -1
- package/src/lib/createDirectorySync.js.map +0 -1
- package/src/lib/createFileExtensionFilter.d.ts +0 -13
- package/src/lib/createFileExtensionFilter.js +0 -32
- package/src/lib/createFileExtensionFilter.js.map +0 -1
- package/src/lib/cwdpath.d.ts +0 -12
- package/src/lib/cwdpath.js +0 -21
- package/src/lib/cwdpath.js.map +0 -1
- package/src/lib/deleteDirectory.d.ts +0 -12
- package/src/lib/deleteDirectory.js +0 -23
- package/src/lib/deleteDirectory.js.map +0 -1
- package/src/lib/deleteDirectorySafe.d.ts +0 -13
- package/src/lib/deleteDirectorySafe.js +0 -25
- package/src/lib/deleteDirectorySafe.js.map +0 -1
- package/src/lib/deleteDirectorySafeSync.d.ts +0 -11
- package/src/lib/deleteDirectorySafeSync.js +0 -23
- package/src/lib/deleteDirectorySafeSync.js.map +0 -1
- package/src/lib/deleteDirectorySync.d.ts +0 -12
- package/src/lib/deleteDirectorySync.js +0 -22
- package/src/lib/deleteDirectorySync.js.map +0 -1
- package/src/lib/ensureValidWindowsPath.d.ts +0 -22
- package/src/lib/ensureValidWindowsPath.js +0 -54
- package/src/lib/ensureValidWindowsPath.js.map +0 -1
- package/src/lib/getDiskDrivesWindows.d.ts +0 -1
- package/src/lib/getDiskDrivesWindows.js +0 -19
- package/src/lib/getDiskDrivesWindows.js.map +0 -1
- package/src/lib/getDownloadsDirectory.d.ts +0 -1
- package/src/lib/getDownloadsDirectory.js +0 -11
- package/src/lib/getDownloadsDirectory.js.map +0 -1
- package/src/lib/getHomeDirectory.d.ts +0 -1
- package/src/lib/getHomeDirectory.js +0 -13
- package/src/lib/getHomeDirectory.js.map +0 -1
- package/src/lib/getLastMofifiedFileIn.js +0 -22
- package/src/lib/getLastMofifiedFileIn.js.map +0 -1
- package/src/lib/getRootDir.d.ts +0 -1
- package/src/lib/getRootDir.js +0 -10
- package/src/lib/getRootDir.js.map +0 -1
- package/src/lib/normalizeFileExtension.d.ts +0 -22
- package/src/lib/normalizeFileExtension.js +0 -36
- package/src/lib/normalizeFileExtension.js.map +0 -1
- package/src/lib/readFileLastLines.d.ts +0 -7
- package/src/lib/readFileLastLines.js +0 -18
- package/src/lib/readFileLastLines.js.map +0 -1
- package/src/lib/readJsonFile.d.ts +0 -12
- package/src/lib/readJsonFile.js +0 -23
- package/src/lib/readJsonFile.js.map +0 -1
- package/src/lib/readJsonFileSync.d.ts +0 -12
- package/src/lib/readJsonFileSync.js +0 -21
- package/src/lib/readJsonFileSync.js.map +0 -1
- package/src/lib/readPackageJson.d.ts +0 -1
- package/src/lib/readPackageJson.js +0 -15
- package/src/lib/readPackageJson.js.map +0 -1
- package/src/lib/removeIllegalFilenameCharacters.d.ts +0 -1
- package/src/lib/removeIllegalFilenameCharacters.js +0 -8
- package/src/lib/removeIllegalFilenameCharacters.js.map +0 -1
- package/src/lib/tempFile.js +0 -26
- package/src/lib/tempFile.js.map +0 -1
- package/src/lib/types/IEnsureValidWindowsPathOptions.d.ts +0 -10
- package/src/lib/types/IEnsureValidWindowsPathOptions.js.map +0 -1
- package/src/lib/updateJsonFile.d.ts +0 -18
- package/src/lib/updateJsonFile.js +0 -44
- package/src/lib/updateJsonFile.js.map +0 -1
- package/src/lib/updateJsonFileSync.d.ts +0 -18
- package/src/lib/updateJsonFileSync.js +0 -42
- package/src/lib/updateJsonFileSync.js.map +0 -1
- package/src/lib/wipeDirectorySafe.d.ts +0 -1
- package/src/lib/wipeDirectorySafe.js +0 -14
- package/src/lib/wipeDirectorySafe.js.map +0 -1
- package/src/lib/writeJsonFile.d.ts +0 -14
- package/src/lib/writeJsonFile.js +0 -25
- package/src/lib/writeJsonFile.js.map +0 -1
- package/src/lib/writeJsonFileSync.d.ts +0 -13
- package/src/lib/writeJsonFileSync.js +0 -22
- package/src/lib/writeJsonFileSync.js.map +0 -1
- /package/{src → cjs}/lib/types/ILogFileData.js +0 -0
- /package/{src → cjs}/lib/types/ILogFileData.js.map +0 -0
package/src/lib/LogFile.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a log file manager that appends log entries to a file.
|
|
3
|
-
* It does not ensure extremely precise ordering of log entries' timestamps if used asynchronously. It logs them as they are received.
|
|
4
|
-
*/
|
|
5
|
-
export declare class LogFile<T> {
|
|
6
|
-
/**
|
|
7
|
-
* The path to the log file.
|
|
8
|
-
*/
|
|
9
|
-
filepath: string;
|
|
10
|
-
/**
|
|
11
|
-
* Creates a new instance of the LogFile class.
|
|
12
|
-
* @param filepath - The path to the log file.
|
|
13
|
-
*/
|
|
14
|
-
constructor(filepath: string);
|
|
15
|
-
/**
|
|
16
|
-
* Appends a log entry to the log file.
|
|
17
|
-
* @param data - The data to be logged.
|
|
18
|
-
* @param time - The timestamp of the log entry. Defaults to the current time.
|
|
19
|
-
* @returns A promise that resolves when the log entry is appended.
|
|
20
|
-
*/
|
|
21
|
-
append(data: T, time?: number): Promise<void>;
|
|
22
|
-
/**
|
|
23
|
-
* Resets the log file by removing it.
|
|
24
|
-
*/
|
|
25
|
-
reset(): void;
|
|
26
|
-
/**
|
|
27
|
-
* Reads the log entire file and returns an array of log entries, sorted by timestamp in descending order.
|
|
28
|
-
* @returns An array of log entries, sorted by timestamp in descending order.
|
|
29
|
-
*/
|
|
30
|
-
readFile(): [number, T][];
|
|
31
|
-
/**
|
|
32
|
-
* Returns an async generator that yields the timestamps of log entries in the log file.
|
|
33
|
-
* @yields The timestamps of log entries.
|
|
34
|
-
*/
|
|
35
|
-
keys(): AsyncGenerator<number>;
|
|
36
|
-
/**
|
|
37
|
-
* Returns an async generator that yields the values of log entries in the log file.
|
|
38
|
-
* @yields The values of log entries.
|
|
39
|
-
*/
|
|
40
|
-
values(): AsyncGenerator<T>;
|
|
41
|
-
/**
|
|
42
|
-
* Returns an async generator that yields the entries (timestamp and value) of log entries in the log file.
|
|
43
|
-
* @yields The entries (timestamp and value) of log entries.
|
|
44
|
-
*/
|
|
45
|
-
entries(): AsyncGenerator<[number, T]>;
|
|
46
|
-
/**
|
|
47
|
-
* Ensures that the directory containing the log file exists.
|
|
48
|
-
*/
|
|
49
|
-
ensureDirectoryExists(): void;
|
|
50
|
-
}
|
package/src/lib/LogFile.js
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LogFile = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
-
const readline_1 = tslib_1.__importDefault(require("readline"));
|
|
8
|
-
/**
|
|
9
|
-
* Represents a log file manager that appends log entries to a file.
|
|
10
|
-
* It does not ensure extremely precise ordering of log entries' timestamps if used asynchronously. It logs them as they are received.
|
|
11
|
-
*/
|
|
12
|
-
class LogFile {
|
|
13
|
-
/**
|
|
14
|
-
* Creates a new instance of the LogFile class.
|
|
15
|
-
* @param filepath - The path to the log file.
|
|
16
|
-
*/
|
|
17
|
-
constructor(filepath) {
|
|
18
|
-
this.filepath = filepath;
|
|
19
|
-
this.ensureDirectoryExists();
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Appends a log entry to the log file.
|
|
23
|
-
* @param data - The data to be logged.
|
|
24
|
-
* @param time - The timestamp of the log entry. Defaults to the current time.
|
|
25
|
-
* @returns A promise that resolves when the log entry is appended.
|
|
26
|
-
*/
|
|
27
|
-
append(data, time = Date.now()) {
|
|
28
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
yield fs_1.default.promises.appendFile(this.filepath, time + '|' + JSON.stringify(data) + '\n', 'utf8');
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Resets the log file by removing it.
|
|
34
|
-
*/
|
|
35
|
-
reset() {
|
|
36
|
-
fs_1.default.rmSync(this.filepath);
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Reads the log entire file and returns an array of log entries, sorted by timestamp in descending order.
|
|
40
|
-
* @returns An array of log entries, sorted by timestamp in descending order.
|
|
41
|
-
*/
|
|
42
|
-
readFile() {
|
|
43
|
-
const data = fs_1.default.readFileSync(this.filepath, 'utf8');
|
|
44
|
-
const lines = data.split('\n');
|
|
45
|
-
const result = [];
|
|
46
|
-
for (const line of lines) {
|
|
47
|
-
const i = line.indexOf('|');
|
|
48
|
-
if (i === -1)
|
|
49
|
-
continue;
|
|
50
|
-
const time = parseInt(line.substring(0, i));
|
|
51
|
-
const data = JSON.parse(line.substring(i + 1));
|
|
52
|
-
result.push([time, data]);
|
|
53
|
-
}
|
|
54
|
-
return result.sort((a, b) => b[0] - a[0]);
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Returns an async generator that yields the timestamps of log entries in the log file.
|
|
58
|
-
* @yields The timestamps of log entries.
|
|
59
|
-
*/
|
|
60
|
-
keys() {
|
|
61
|
-
return tslib_1.__asyncGenerator(this, arguments, function* keys_1() {
|
|
62
|
-
var _a, e_1, _b, _c;
|
|
63
|
-
const fileStream = fs_1.default.createReadStream(this.filepath, 'utf8');
|
|
64
|
-
const rl = readline_1.default.createInterface({
|
|
65
|
-
input: fileStream,
|
|
66
|
-
crlfDelay: Infinity,
|
|
67
|
-
});
|
|
68
|
-
try {
|
|
69
|
-
for (var _d = true, rl_1 = tslib_1.__asyncValues(rl), rl_1_1; rl_1_1 = yield tslib_1.__await(rl_1.next()), _a = rl_1_1.done, !_a; _d = true) {
|
|
70
|
-
_c = rl_1_1.value;
|
|
71
|
-
_d = false;
|
|
72
|
-
const line = _c;
|
|
73
|
-
const i = line.indexOf('|');
|
|
74
|
-
const time = parseInt(line.substring(0, i));
|
|
75
|
-
yield yield tslib_1.__await(time);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
79
|
-
finally {
|
|
80
|
-
try {
|
|
81
|
-
if (!_d && !_a && (_b = rl_1.return)) yield tslib_1.__await(_b.call(rl_1));
|
|
82
|
-
}
|
|
83
|
-
finally { if (e_1) throw e_1.error; }
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Returns an async generator that yields the values of log entries in the log file.
|
|
89
|
-
* @yields The values of log entries.
|
|
90
|
-
*/
|
|
91
|
-
values() {
|
|
92
|
-
return tslib_1.__asyncGenerator(this, arguments, function* values_1() {
|
|
93
|
-
var _a, e_2, _b, _c;
|
|
94
|
-
const fileStream = fs_1.default.createReadStream(this.filepath, 'utf8');
|
|
95
|
-
const rl = readline_1.default.createInterface({
|
|
96
|
-
input: fileStream,
|
|
97
|
-
crlfDelay: Infinity,
|
|
98
|
-
});
|
|
99
|
-
try {
|
|
100
|
-
for (var _d = true, rl_2 = tslib_1.__asyncValues(rl), rl_2_1; rl_2_1 = yield tslib_1.__await(rl_2.next()), _a = rl_2_1.done, !_a; _d = true) {
|
|
101
|
-
_c = rl_2_1.value;
|
|
102
|
-
_d = false;
|
|
103
|
-
const line = _c;
|
|
104
|
-
const i = line.indexOf('|');
|
|
105
|
-
const data = JSON.parse(line.substring(i + 1));
|
|
106
|
-
yield yield tslib_1.__await(data);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
110
|
-
finally {
|
|
111
|
-
try {
|
|
112
|
-
if (!_d && !_a && (_b = rl_2.return)) yield tslib_1.__await(_b.call(rl_2));
|
|
113
|
-
}
|
|
114
|
-
finally { if (e_2) throw e_2.error; }
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Returns an async generator that yields the entries (timestamp and value) of log entries in the log file.
|
|
120
|
-
* @yields The entries (timestamp and value) of log entries.
|
|
121
|
-
*/
|
|
122
|
-
entries() {
|
|
123
|
-
return tslib_1.__asyncGenerator(this, arguments, function* entries_1() {
|
|
124
|
-
var _a, e_3, _b, _c;
|
|
125
|
-
const fileStream = fs_1.default.createReadStream(this.filepath, 'utf8');
|
|
126
|
-
const rl = readline_1.default.createInterface({
|
|
127
|
-
input: fileStream,
|
|
128
|
-
crlfDelay: Infinity,
|
|
129
|
-
});
|
|
130
|
-
try {
|
|
131
|
-
for (var _d = true, rl_3 = tslib_1.__asyncValues(rl), rl_3_1; rl_3_1 = yield tslib_1.__await(rl_3.next()), _a = rl_3_1.done, !_a; _d = true) {
|
|
132
|
-
_c = rl_3_1.value;
|
|
133
|
-
_d = false;
|
|
134
|
-
const line = _c;
|
|
135
|
-
const i = line.indexOf('|');
|
|
136
|
-
const time = parseInt(line.substring(0, i));
|
|
137
|
-
const data = JSON.parse(line.substring(i + 1));
|
|
138
|
-
yield yield tslib_1.__await([time, data]);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
142
|
-
finally {
|
|
143
|
-
try {
|
|
144
|
-
if (!_d && !_a && (_b = rl_3.return)) yield tslib_1.__await(_b.call(rl_3));
|
|
145
|
-
}
|
|
146
|
-
finally { if (e_3) throw e_3.error; }
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Ensures that the directory containing the log file exists.
|
|
152
|
-
*/
|
|
153
|
-
ensureDirectoryExists() {
|
|
154
|
-
fs_1.default.mkdirSync(path_1.default.dirname(this.filepath), { recursive: true });
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
exports.LogFile = LogFile;
|
|
158
|
-
//# sourceMappingURL=LogFile.js.map
|
package/src/lib/LogFile.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LogFile.js","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/LogFile.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* If the filepath is somewhere in the current working directory, it can be converted into a relative path.
|
|
3
|
-
* @remarks This function takes an absolute path as input and returns a relative path. It replaces the current working directory in the path with an empty string,
|
|
4
|
-
* replaces all backslashes with forward slashes, and removes any leading forward slashes.
|
|
5
|
-
* @param workingDirectory The directory relative to which the path should be converted. Defaults to the current working directory.
|
|
6
|
-
* @returns The relative path.
|
|
7
|
-
* @param absolute the absolute filepath to convert.
|
|
8
|
-
* @example ```ts
|
|
9
|
-
* absoluteToRelativePath(__filename)
|
|
10
|
-
* //=> 'src/absoluteToRelativePath.ts'
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
export declare function absoluteToRelativePath(absolute: string, workingDirectory?: string): string;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.absoluteToRelativePath = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const string_1 = require("@bemoje/string");
|
|
6
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
-
/**
|
|
8
|
-
* If the filepath is somewhere in the current working directory, it can be converted into a relative path.
|
|
9
|
-
* @remarks This function takes an absolute path as input and returns a relative path. It replaces the current working directory in the path with an empty string,
|
|
10
|
-
* replaces all backslashes with forward slashes, and removes any leading forward slashes.
|
|
11
|
-
* @param workingDirectory The directory relative to which the path should be converted. Defaults to the current working directory.
|
|
12
|
-
* @returns The relative path.
|
|
13
|
-
* @param absolute the absolute filepath to convert.
|
|
14
|
-
* @example ```ts
|
|
15
|
-
* absoluteToRelativePath(__filename)
|
|
16
|
-
* //=> 'src/absoluteToRelativePath.ts'
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
function absoluteToRelativePath(absolute, workingDirectory = process.cwd()) {
|
|
20
|
-
return path_1.default
|
|
21
|
-
.normalize(absolute)
|
|
22
|
-
.replace(new RegExp((0, string_1.regexEscapeString)(path_1.default.normalize(workingDirectory) + path_1.default.sep), 'i'), '');
|
|
23
|
-
}
|
|
24
|
-
exports.absoluteToRelativePath = absoluteToRelativePath;
|
|
25
|
-
//# sourceMappingURL=absoluteToRelativePath.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"absoluteToRelativePath.js","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/absoluteToRelativePath.ts"],"names":[],"mappings":";;;;AAAA,2CAAkD;AAClD,wDAAuB;AAEvB;;;;;;;;;;;GAWG;AACH,SAAgB,sBAAsB,CAAC,QAAgB,EAAE,gBAAgB,GAAG,OAAO,CAAC,GAAG,EAAE;IACvF,OAAO,cAAI;SACR,SAAS,CAAC,QAAQ,CAAC;SACnB,OAAO,CAAC,IAAI,MAAM,CAAC,IAAA,0BAAiB,EAAC,cAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,GAAG,cAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAA;AACjG,CAAC;AAJD,wDAIC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Append a line to a file. Creates the file if it does not exist.
|
|
3
|
-
* @param filepath The path of the file.
|
|
4
|
-
* @param line The string data to append.
|
|
5
|
-
* @returns A Promise that resolves when the line has been appended to the file.
|
|
6
|
-
* @throws Will throw an error if the operation fails.
|
|
7
|
-
* @example ```ts
|
|
8
|
-
* await appendLineToFile('/path/to/file', 'This is a new line')
|
|
9
|
-
* ```
|
|
10
|
-
*/
|
|
11
|
-
export declare function appendLineToFile(filepath: string, line: string, linebreakBefore?: boolean): Promise<void>;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.appendLineToFile = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
-
const createDirectory_1 = require("./createDirectory");
|
|
8
|
-
/**
|
|
9
|
-
* Append a line to a file. Creates the file if it does not exist.
|
|
10
|
-
* @param filepath The path of the file.
|
|
11
|
-
* @param line The string data to append.
|
|
12
|
-
* @returns A Promise that resolves when the line has been appended to the file.
|
|
13
|
-
* @throws Will throw an error if the operation fails.
|
|
14
|
-
* @example ```ts
|
|
15
|
-
* await appendLineToFile('/path/to/file', 'This is a new line')
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
function appendLineToFile(filepath, line, linebreakBefore = false) {
|
|
19
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
if (!fs_1.default.existsSync(filepath)) {
|
|
21
|
-
yield (0, createDirectory_1.createDirectory)(path_1.default.dirname(filepath));
|
|
22
|
-
yield fs_1.default.promises.writeFile(filepath, '');
|
|
23
|
-
}
|
|
24
|
-
yield fs_1.default.promises.appendFile(filepath, linebreakBefore ? '\n' + line : line + '\n');
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
exports.appendLineToFile = appendLineToFile;
|
|
28
|
-
//# sourceMappingURL=appendLineToFile.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"appendLineToFile.js","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/appendLineToFile.ts"],"names":[],"mappings":";;;;AAAA,oDAAmB;AACnB,wDAAuB;AACvB,uDAAmD;AAEnD;;;;;;;;;GASG;AACH,SAAsB,gBAAgB,CAAC,QAAgB,EAAE,IAAY,EAAE,eAAe,GAAG,KAAK;;QAC5F,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;YAC5B,MAAM,IAAA,iCAAe,EAAC,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAA;YAC7C,MAAM,YAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;SAC1C;QACD,MAAM,YAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,CAAA;IACrF,CAAC;CAAA;AAND,4CAMC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import type { Stats } from 'fs';
|
|
3
|
-
/**
|
|
4
|
-
* Synchronously cleans a directory by removing files that satisfy a given predicate.
|
|
5
|
-
* @remarks This function is a part of the File System module.
|
|
6
|
-
* @param dirpath - The path to the directory that needs to be cleaned.
|
|
7
|
-
* @param predicate - A function that takes a filepath and its stats as arguments and returns a boolean. If the function returns true for a file, that file is removed from the directory.
|
|
8
|
-
* @throws If the directory at the provided path does not exist or cannot be read.
|
|
9
|
-
* @example ```ts
|
|
10
|
-
* import { Stats } from 'fs';
|
|
11
|
-
* const dirpath = './my-directory';
|
|
12
|
-
* const predicate = (filepath: string, stat: Stats) => stat.size > 1024;
|
|
13
|
-
* cleanDirectorySync(dirpath, predicate);
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export declare function cleanDirectorySync(dirpath: string, predicate: (filepath: string, stat: Stats) => boolean): void;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cleanDirectorySync = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
-
/**
|
|
8
|
-
* Synchronously cleans a directory by removing files that satisfy a given predicate.
|
|
9
|
-
* @remarks This function is a part of the File System module.
|
|
10
|
-
* @param dirpath - The path to the directory that needs to be cleaned.
|
|
11
|
-
* @param predicate - A function that takes a filepath and its stats as arguments and returns a boolean. If the function returns true for a file, that file is removed from the directory.
|
|
12
|
-
* @throws If the directory at the provided path does not exist or cannot be read.
|
|
13
|
-
* @example ```ts
|
|
14
|
-
* import { Stats } from 'fs';
|
|
15
|
-
* const dirpath = './my-directory';
|
|
16
|
-
* const predicate = (filepath: string, stat: Stats) => stat.size > 1024;
|
|
17
|
-
* cleanDirectorySync(dirpath, predicate);
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
function cleanDirectorySync(dirpath, predicate) {
|
|
21
|
-
for (const filename of fs_1.default.readdirSync(dirpath)) {
|
|
22
|
-
const filepath = path_1.default.join(dirpath, filename);
|
|
23
|
-
const stat = fs_1.default.statSync(filepath);
|
|
24
|
-
if (predicate(filepath, stat))
|
|
25
|
-
fs_1.default.unlinkSync(filepath);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.cleanDirectorySync = cleanDirectorySync;
|
|
29
|
-
//# sourceMappingURL=cleanDirectorySync.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cleanDirectorySync.js","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/cleanDirectorySync.ts"],"names":[],"mappings":";;;;AACA,oDAAmB;AACnB,wDAAuB;AAEvB;;;;;;;;;;;;GAYG;AACH,SAAgB,kBAAkB,CAAC,OAAe,EAAE,SAAqD;IACvG,KAAK,MAAM,QAAQ,IAAI,YAAE,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE;QAC9C,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;QAC7C,MAAM,IAAI,GAAG,YAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;QAClC,IAAI,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC;YAAE,YAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;KACvD;AACH,CAAC;AAND,gDAMC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createDirectory = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
-
/**
|
|
7
|
-
* Create a directory at a given path if it does not exist.
|
|
8
|
-
* Automatically creates parent directories if they do not exist.
|
|
9
|
-
* @param dirpath The path where the directory should be created.
|
|
10
|
-
* @returns The path of the directory.
|
|
11
|
-
* @throws Will throw an error if the directory cannot be created.
|
|
12
|
-
* @example ```ts
|
|
13
|
-
* createDirectory('/path/to/directory').then((dirpath) => {
|
|
14
|
-
* //=> `Directory created at ${dirpath}`
|
|
15
|
-
* });
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
function createDirectory(dirpath) {
|
|
19
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
yield fs_1.default.promises.mkdir(dirpath, { recursive: true });
|
|
21
|
-
return dirpath;
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
exports.createDirectory = createDirectory;
|
|
25
|
-
//# sourceMappingURL=createDirectory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createDirectory.js","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/createDirectory.ts"],"names":[],"mappings":";;;;AAAA,oDAAmB;AACnB;;;;;;;;;;;GAWG;AACH,SAAsB,eAAe,CAAC,OAAe;;QACnD,MAAM,YAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QACrD,OAAO,OAAO,CAAA;IAChB,CAAC;CAAA;AAHD,0CAGC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createDirectorySync.js","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/createDirectorySync.ts"],"names":[],"mappings":";;;;AAAA,oDAAmB;AAEnB;;;;;;;;GAQG;AACH,SAAgB,mBAAmB,CAAC,OAAe;IACjD,YAAE,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IAC1C,OAAO,OAAO,CAAA;AAChB,CAAC;AAHD,kDAGC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Takes a list of file extensions and returns a filter function that returns true if a filepath/filename passed to it contains one of the given file extensions.
|
|
3
|
-
* @remarks If no file extensions are provided, the filter will always return true.
|
|
4
|
-
* @returns A function that takes a filepath and returns true if the filepath has one of the specified file extensions, false otherwise.
|
|
5
|
-
* @param fileExtensions file extensions
|
|
6
|
-
* @example ```ts
|
|
7
|
-
* createFileExtensionFilter('.ts', '.tsx')('index.ts');;
|
|
8
|
-
* //=> true
|
|
9
|
-
* createFileExtensionFilter('.ts', '.tsx')('index.js');;
|
|
10
|
-
* //=> false
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
export declare function createFileExtensionFilter(...fileExtensions: string[]): (filepath: string) => boolean;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createFileExtensionFilter = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
|
-
const normalizeFileExtension_1 = require("./normalizeFileExtension");
|
|
7
|
-
/**
|
|
8
|
-
* Takes a list of file extensions and returns a filter function that returns true if a filepath/filename passed to it contains one of the given file extensions.
|
|
9
|
-
* @remarks If no file extensions are provided, the filter will always return true.
|
|
10
|
-
* @returns A function that takes a filepath and returns true if the filepath has one of the specified file extensions, false otherwise.
|
|
11
|
-
* @param fileExtensions file extensions
|
|
12
|
-
* @example ```ts
|
|
13
|
-
* createFileExtensionFilter('.ts', '.tsx')('index.ts');;
|
|
14
|
-
* //=> true
|
|
15
|
-
* createFileExtensionFilter('.ts', '.tsx')('index.js');;
|
|
16
|
-
* //=> false
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
function createFileExtensionFilter(...fileExtensions) {
|
|
20
|
-
if (!fileExtensions.length)
|
|
21
|
-
return () => true;
|
|
22
|
-
return (filepath) => {
|
|
23
|
-
for (const ext of fileExtensions.map(normalizeFileExtension_1.normalizeFileExtension)) {
|
|
24
|
-
if (path_1.default.extname(filepath) === ext) {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return false;
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
exports.createFileExtensionFilter = createFileExtensionFilter;
|
|
32
|
-
//# sourceMappingURL=createFileExtensionFilter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createFileExtensionFilter.js","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/createFileExtensionFilter.ts"],"names":[],"mappings":";;;;AAAA,wDAAuB;AACvB,qEAAiE;AAEjE;;;;;;;;;;;GAWG;AACH,SAAgB,yBAAyB,CAAC,GAAG,cAAwB;IACnE,IAAI,CAAC,cAAc,CAAC,MAAM;QAAE,OAAO,GAAG,EAAE,CAAC,IAAI,CAAA;IAC7C,OAAO,CAAC,QAAgB,EAAE,EAAE;QAC1B,KAAK,MAAM,GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,+CAAsB,CAAC,EAAE;YAC5D,IAAI,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,GAAG,EAAE;gBAClC,OAAO,IAAI,CAAA;aACZ;SACF;QACD,OAAO,KAAK,CAAA;IACd,CAAC,CAAA;AACH,CAAC;AAVD,8DAUC"}
|
package/src/lib/cwdpath.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Joins the given path segments to the current working directory path, and normalizes the resulting path.
|
|
3
|
-
* @remarks
|
|
4
|
-
* The function uses the `path.join` method from the Node.js `path` module, and the `process.cwd` method from the Node.js `process` module.
|
|
5
|
-
* @param paths - The path segments to join to the current working directory path.
|
|
6
|
-
* @returns The resulting path.
|
|
7
|
-
* @example ```ts
|
|
8
|
-
* console.log(cwdpath('src', 'index.ts'));
|
|
9
|
-
* //=> '{working_directory}/src/index.ts'
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
export declare function cwdpath(...paths: string[]): string;
|
package/src/lib/cwdpath.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cwdpath = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
|
-
/**
|
|
7
|
-
* Joins the given path segments to the current working directory path, and normalizes the resulting path.
|
|
8
|
-
* @remarks
|
|
9
|
-
* The function uses the `path.join` method from the Node.js `path` module, and the `process.cwd` method from the Node.js `process` module.
|
|
10
|
-
* @param paths - The path segments to join to the current working directory path.
|
|
11
|
-
* @returns The resulting path.
|
|
12
|
-
* @example ```ts
|
|
13
|
-
* console.log(cwdpath('src', 'index.ts'));
|
|
14
|
-
* //=> '{working_directory}/src/index.ts'
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
function cwdpath(...paths) {
|
|
18
|
-
return path_1.default.join(process.cwd(), ...paths);
|
|
19
|
-
}
|
|
20
|
-
exports.cwdpath = cwdpath;
|
|
21
|
-
//# sourceMappingURL=cwdpath.js.map
|
package/src/lib/cwdpath.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cwdpath.js","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/cwdpath.ts"],"names":[],"mappings":";;;;AAAA,wDAAuB;AAEvB;;;;;;;;;;GAUG;AACH,SAAgB,OAAO,CAAC,GAAG,KAAe;IACxC,OAAO,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,GAAG,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,0BAEC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deletes a directory and all of its contents.
|
|
3
|
-
* @remarks This function uses Node.js's `fs.promises.rm` method with the `recursive` and `force` options set to `true`.
|
|
4
|
-
* This means it will delete the directory and all of its contents, even if the directory is not empty.
|
|
5
|
-
* @param dirpath The path to the directory to delete.
|
|
6
|
-
* @returns A Promise that resolves when the directory has been deleted.
|
|
7
|
-
* @throws Will throw an error if the directory does not exist, or if there was a problem deleting the directory.
|
|
8
|
-
* @example ```ts
|
|
9
|
-
* deleteDirectory('/path/to/directory');
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
export declare function deleteDirectory(dirpath: string): Promise<void>;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deleteDirectory = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
-
/**
|
|
7
|
-
* Deletes a directory and all of its contents.
|
|
8
|
-
* @remarks This function uses Node.js's `fs.promises.rm` method with the `recursive` and `force` options set to `true`.
|
|
9
|
-
* This means it will delete the directory and all of its contents, even if the directory is not empty.
|
|
10
|
-
* @param dirpath The path to the directory to delete.
|
|
11
|
-
* @returns A Promise that resolves when the directory has been deleted.
|
|
12
|
-
* @throws Will throw an error if the directory does not exist, or if there was a problem deleting the directory.
|
|
13
|
-
* @example ```ts
|
|
14
|
-
* deleteDirectory('/path/to/directory');
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
function deleteDirectory(dirpath) {
|
|
18
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
yield fs_1.default.promises.rm(dirpath, { recursive: true, force: true });
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
exports.deleteDirectory = deleteDirectory;
|
|
23
|
-
//# sourceMappingURL=deleteDirectory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deleteDirectory.js","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/deleteDirectory.ts"],"names":[],"mappings":";;;;AAAA,oDAAmB;AAEnB;;;;;;;;;;GAUG;AACH,SAAsB,eAAe,CAAC,OAAe;;QACnD,MAAM,YAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IACjE,CAAC;CAAA;AAFD,0CAEC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deletes a directory safely if it exists.
|
|
3
|
-
* @remarks This function uses Node.js' `fs.promises.rm` method with the `recursive` and `force` options set to `true`.
|
|
4
|
-
* This means it will delete the directory and all its contents, even if the directory is not empty.
|
|
5
|
-
* @param dirpath The path of the directory to delete.
|
|
6
|
-
* @returns A promise that resolves to `void` when the directory has been deleted.
|
|
7
|
-
* @throws Will throw an error if the `fs.promises.rm` operation fails.
|
|
8
|
-
* @example ```ts
|
|
9
|
-
* deleteDirectorySafe('/path/to/directory');;
|
|
10
|
-
* //=> undefined
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
export declare function deleteDirectorySafe(dirpath: string): Promise<void>;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deleteDirectorySafe = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
-
/**
|
|
7
|
-
* Deletes a directory safely if it exists.
|
|
8
|
-
* @remarks This function uses Node.js' `fs.promises.rm` method with the `recursive` and `force` options set to `true`.
|
|
9
|
-
* This means it will delete the directory and all its contents, even if the directory is not empty.
|
|
10
|
-
* @param dirpath The path of the directory to delete.
|
|
11
|
-
* @returns A promise that resolves to `void` when the directory has been deleted.
|
|
12
|
-
* @throws Will throw an error if the `fs.promises.rm` operation fails.
|
|
13
|
-
* @example ```ts
|
|
14
|
-
* deleteDirectorySafe('/path/to/directory');;
|
|
15
|
-
* //=> undefined
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
function deleteDirectorySafe(dirpath) {
|
|
19
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
if (fs_1.default.existsSync(dirpath))
|
|
21
|
-
yield fs_1.default.promises.rm(dirpath, { recursive: true, force: true });
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
exports.deleteDirectorySafe = deleteDirectorySafe;
|
|
25
|
-
//# sourceMappingURL=deleteDirectorySafe.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deleteDirectorySafe.js","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/deleteDirectorySafe.ts"],"names":[],"mappings":";;;;AAAA,oDAAmB;AAEnB;;;;;;;;;;;GAWG;AACH,SAAsB,mBAAmB,CAAC,OAAe;;QACvD,IAAI,YAAE,CAAC,UAAU,CAAC,OAAO,CAAC;YAAE,MAAM,YAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IAC7F,CAAC;CAAA;AAFD,kDAEC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deletes a directory synchronously in a safe manner. If the directory does not exist, it will simply return the directory path without throwing an error.
|
|
3
|
-
* @param dirpath The path of the directory to be deleted.
|
|
4
|
-
* @returns The path of the directory that was intended to be deleted.
|
|
5
|
-
* @throws Will throw an error if the operation fails for reasons other than the directory not existing.
|
|
6
|
-
* @example ```ts
|
|
7
|
-
* deleteDirectorySafeSync('/path/to/directory');;
|
|
8
|
-
* //=> undefined
|
|
9
|
-
* ```
|
|
10
|
-
*/
|
|
11
|
-
export declare function deleteDirectorySafeSync(dirpath: string): string;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deleteDirectorySafeSync = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
-
/**
|
|
7
|
-
* Deletes a directory synchronously in a safe manner. If the directory does not exist, it will simply return the directory path without throwing an error.
|
|
8
|
-
* @param dirpath The path of the directory to be deleted.
|
|
9
|
-
* @returns The path of the directory that was intended to be deleted.
|
|
10
|
-
* @throws Will throw an error if the operation fails for reasons other than the directory not existing.
|
|
11
|
-
* @example ```ts
|
|
12
|
-
* deleteDirectorySafeSync('/path/to/directory');;
|
|
13
|
-
* //=> undefined
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
function deleteDirectorySafeSync(dirpath) {
|
|
17
|
-
if (!fs_1.default.existsSync(dirpath))
|
|
18
|
-
return dirpath;
|
|
19
|
-
fs_1.default.rmSync(dirpath, { recursive: true, force: true });
|
|
20
|
-
return dirpath;
|
|
21
|
-
}
|
|
22
|
-
exports.deleteDirectorySafeSync = deleteDirectorySafeSync;
|
|
23
|
-
//# sourceMappingURL=deleteDirectorySafeSync.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deleteDirectorySafeSync.js","sourceRoot":"","sources":["../../../../../packages/fs/src/lib/deleteDirectorySafeSync.ts"],"names":[],"mappings":";;;;AAAA,oDAAmB;AAEnB;;;;;;;;;GASG;AACH,SAAgB,uBAAuB,CAAC,OAAe;IACrD,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAA;IAC3C,YAAE,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IACpD,OAAO,OAAO,CAAA;AAChB,CAAC;AAJD,0DAIC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deletes a directory synchronously.
|
|
3
|
-
* @remarks This function uses Node.js's `fs.rmSync` method with the options `{ recursive: true, force: true }`.
|
|
4
|
-
* @param dirpath The path of the directory to delete.
|
|
5
|
-
* @returns The path of the deleted directory.
|
|
6
|
-
* @throws Will throw an error if the directory does not exist or if the process lacks permissions to delete it.
|
|
7
|
-
* @example ```ts
|
|
8
|
-
* deleteDirectorySync('/path/to/directory');;
|
|
9
|
-
* //=> undefined
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
export declare function deleteDirectorySync(dirpath: string): string;
|