Functions -
file
copy | Copy file/directory in old path to new path. If new path already exists, this replaces the file. |
createDir | Creates a new directory with the specified file name. If parentDirs flag is true, Creates a directory in specified path with any necessary parents. |
createFile | Creates a file in specified file path. Truncates if file already exists in the given path. |
exists | Reports whether file or directory exists for the given the path. |
getCurrentDirectory | Returns the current working directory. |
getFileInfo | Returns metadata information of the file specified in file path. |
readDir | Reads the directory and returns a list of files and directories # inside the specified directory |
remove | Removes the specified file or directory. If recursive flag is true, Removes the path and any children it contains. |
rename | Renames(Moves) old path to new path. If new path already exists and it is not a directory, this replaces the file. |
tempDir | Returns the default directory to use for temporary files. |
Copy file/directory in old path to new path. If new path already exists, this replaces the file.
Parameters
- sourcePath string
-
String value of old file path.
- destinationPath string
-
String value of new file path.
- replaceExisting boolean - false
-
Flag to allow replace if file already exists in destination path.
-
Return Type
(Error?) Returns an
Error
if failed to rename.
Creates a new directory with the specified file name. If parentDirs flag is true, Creates a directory in specified path with any necessary parents.
Creates a file in specified file path. Truncates if file already exists in the given path.
Parameters
- path string
-
String value of file path.
Reports whether file or directory exists for the given the path.
Parameters
- path string
-
String value of file path.
-
Return Type
(boolean) True if path is absolute, else false
Returns the current working directory.
-
Return Type
(string) Current working directory or an empty string if the current working directory cannot be determined
Returns metadata information of the file specified in file path.
Parameters
- path string
-
String value of the file path.
Reads the directory and returns a list of files and directories # inside the specified directory
Removes the specified file or directory. If recursive flag is true, Removes the path and any children it contains.
Parameters
- path string
-
String value of file/directory path.
- recursive boolean - false
-
Indicates whether the
remove
should recursively remove all the file inside the given directory.
-
Return Type
(Error?) Returns an
Error
if failed to remove.