-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
53 changed files
with
742 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './compareDirectories'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export { default as iterateDirectoryChildren } from './iterate_directory_children'; | ||
export { default as compareDirectories } from './compare_directories'; | ||
export { default as iterateDirectoryChildren } from './iterateDirectoryChildren'; | ||
export { default as compareDirectories } from './compareDirectories'; | ||
export { FsEntry } from './models'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './iterateDirectoryChildren'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import iterateDirectoryChildrenRecursive from './iterateDirectoryChildrenRecursive'; | ||
import { OnEachChild } from './types'; | ||
import validateArgs from './validateArgs'; | ||
|
||
const iterateDirectoryChildren = async ( | ||
dirPath: string, | ||
onEachChild: OnEachChild, | ||
): Promise<void> => { | ||
await validateArgs(dirPath, onEachChild); | ||
await iterateDirectoryChildrenRecursive(dirPath, null, onEachChild); | ||
}; | ||
|
||
export default iterateDirectoryChildren; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { validateDirPathArg, validateFunctionArg } from '../utils/validations'; | ||
|
||
const validateArgs = async (dirPath: unknown, onEachChild: unknown): Promise<void> => { | ||
await validateDirPathArg(dirPath, 'Directory'); | ||
|
||
validateFunctionArg(onEachChild, 'onEachChild', { | ||
isRequired: true, | ||
}); | ||
}; | ||
|
||
export default validateArgs; |
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
src/iterate_directory_children/iterate_directory_children.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
test/cases/models/fs_entry.test.ts → src/models/FsEntry.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
// eslint-disable-next-line import/prefer-default-export | ||
export { default as FsEntry } from './fs_entry'; | ||
export { default as FsEntry } from './FsEntry'; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
8 changes: 3 additions & 5 deletions
8
.../utils/fs/are_file_contents_equal.test.ts → src/utils/fs/areFileContentsEqual.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { createReadStream } from 'fs'; | ||
import * as streamEqual from 'stream-equal'; | ||
|
||
const areFileContentsEqual = async (filePath1: string, filePath2: string): Promise<boolean> => { | ||
const stream1 = createReadStream(filePath1); | ||
const stream2 = createReadStream(filePath2); | ||
|
||
return streamEqual(stream1, stream2); | ||
}; | ||
|
||
export default areFileContentsEqual; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { default as areFileContentsEqual } from './areFileContentsEqual'; | ||
export { default as isDirExist } from './isDirExist'; |
4 changes: 2 additions & 2 deletions
4
test/cases/utils/fs/dir_exists.test.ts → src/utils/fs/isDirExist.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { stat } from 'fs/promises'; | ||
|
||
const isDirExist = async (path: string): Promise<boolean> => { | ||
try { | ||
const stats = await stat(path); | ||
return stats.isDirectory(); | ||
} catch (err) { | ||
return false; | ||
} | ||
}; | ||
|
||
export default isDirExist; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// eslint-disable-next-line import/prefer-default-export | ||
export { default as iterateInSeries } from './iterateInSeries'; |
Oops, something went wrong.