File
Helper functions for file operations.
Functions
copyFileOrDirectory()
function copyFileOrDirectory(srcPath, dstPath): void
Helper function to synchronously copy a file or directory. If a path to a directory is specified, the directory will be recursively copied.
This will throw an error if the file cannot be copied.
Parameters
Parameter | Type |
---|---|
srcPath | string |
dstPath | string |
Returns
void
Defined in
packages/complete-node/src/functions/file.ts:20
copyFileOrDirectoryAsync()
function copyFileOrDirectoryAsync(srcPath, dstPath): Promise<void>
Helper function to asynchronously copy a file or directory. If a path to a directory is specified, the directory will be recursively copied.
This will throw an error if the file cannot be copied.
Parameters
Parameter | Type |
---|---|
srcPath | string |
dstPath | string |
Returns
Promise
<void
>
Defined in
packages/complete-node/src/functions/file.ts:38
cp()
function cp(srcPath, dstPath): void
Alias for the copyFileOrDirectory
function. Intended to be used in scripts.
Parameters
Parameter | Type |
---|---|
srcPath | string |
dstPath | string |
Returns
void
Defined in
packages/complete-node/src/functions/file.ts:54
deleteFileOrDirectory()
function deleteFileOrDirectory(...filePaths): void
Helper function to synchronously delete a file or directory. If a path to a directory is specified, the directory will be recursively deleted. If the path does not exist, this function will be a no-op.
This will throw an error if the file cannot be deleted.
This function is variadic, meaning that you can pass as many file paths as you want to delete.
Parameters
Parameter | Type |
---|---|
...filePaths | readonly string [] |
Returns
void
Defined in
packages/complete-node/src/functions/file.ts:67
fileOrDirectoryExists()
function fileOrDirectoryExists(filePath): boolean
Helper function to synchronously check if a file exists.
This will throw an error if there is an error when checking the file path.
Parameters
Parameter | Type |
---|---|
filePath | string |
Returns
boolean