Module :
file
Module Overview
This module contains functions to perform file system based operations such as create, delete, rename the file/directory, and retrieve metadata of the file.
For an example on the usage of the operations, see the File Example.
Directory Listener
The Directory Listener
is used to listen to a directory in the local file system. It notifies when new files are created in the directory or when the existing files are deleted or modified.
For an example on the usage of the operations, see the Directory Listener Example.
FileEvent |
Represents an event which will trigger when there is a changes to listining direcotry. |
ListenerConfig |
Represents configurations that required for directory listener. |
FileInfo |
FileInfo record contains metadata information of a file. This record is returned by getFileInfo function is os module. |
Listener |
Represents the directory listener endpoint, which is used to listen to a directory in the local file system. |
copy |
Copy the file/directory in the old path to the new path. If a file already exists in the new path, this replaces that file. |
createDir |
Creates a new directory with the specified file name.
If the |
createFile |
Creates a file in the specified file path. Truncates if the file already exists in the given path. |
exists |
Reports whether the file or directory exists in the given the path. |
getCurrentDirectory |
Returns the current working directory. |
getFileInfo |
Returns the metadata information of the file specified in the 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 the recursive flag is true, it removes the path and any children it contains. |
rename |
Renames(Moves) the old path with the new path. If the new path already exists and it is not a directory, this replaces the file. |
tempDir |
Returns the default directory to use for temporary files. |
Error |
Represents file system related errors. |
FileNotFoundError |
Represents an error that occurs when the file/directory does not exist at the given filepath. |
FileSystemError |
Represents an error that occurs when a file system operation fails. |
InvalidOperationError |
Represents an error that occurs when a file system operation is denied due to invalidity. |
PermissionError |
Represents an error that occurs when a file system operation is denied, due to the absence of file permission. |