Functions -
system
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. |
getEnv | Returns the environment variable value associated with the provided name. |
getFileInfo | Returns metadata information of the file specified in file path. |
getUserHome | Returns the current user's home directory path. |
getUsername | Returns the current user's name. |
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. |
uuid | Returns a random UUID string. |
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 the environment variable value associated with the provided name.
Parameters
- name string
-
Name of the environment variable
-
Return Type
(string) Environment variable value if it exists, otherwise an empty string
Returns metadata information of the file specified in file path.
Parameters
- path string
-
String value of the file path.
Returns the current user's home directory path.
-
Return Type
(string) Current user's home directory if it can be determined, an empty string otherwise
Returns the current user's name.
-
Return Type
(string) Current user's name if it can be determined, an empty string otherwise
Reads the directory and returns a list of files and directories # inside the specified directory
Parameters
- path string
-
String value of directory path.
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.
Renames(Moves) old path to new path. If new path already exists and it is not a directory, this replaces the file.
Parameters
- oldPath string
-
String value of old file path.
- newPath string
-
String value of new file path.
-
Return Type
(error?) Returns an
error
if failed to rename.
Returns the default directory to use for temporary files.
-
Return Type
(string) Temporary directory location.