FileManager
Services.get("FileManager")
Overview:
Functions:
API Reference
fileExists()
fileExists()Returns true if the file exists or false if it does not exist or is inaccessible.
fileManager.fileExists("config.json")Parameters:
path(String)
Returns Boolean.
read()
read()Returns the data of a readable file (in String) if successfully ran.
Parameters:
path(String)
Returns String.
write()
write()Writes the data (in String) on the file, overwriting its previous data.
Parameters:
path(String)data(String) ⇒ The content that will be written to the file
Returns:
createFile()
createFile()Creates a file (if it does not exist) on the specified path. Use forward slashes "/" to jump to folders.
Parameters:
path(String)
Returns: java.io.File
createFolder()
createFolder()Creates a folder (if it does not exist) on the specified path. Use forward slashes "/" to jump to folders.
Parameters:
path(String)
Returns:
listenOnPath()
listenOnPath()Allows scripts to listen for file changes on the specified path.
Parameters:
path(String)listenerType(String) ⇒"ENTRY_CREATE"When a file gets added/created ⇒"ENTRY_DELETE"When a file gets removed/moved ⇒"ENTRY_MODIFY"When a file gets modified/edited
Returns (function handler):
File
java.io.FileEvent Type
"ENTRY_CREATE"or"ENTRY_DELETE"or"ENTRY_MODIFY"
clearFileListeners()
clearFileListeners()Removes all of the file listeners created by the current script.
Example:
Last updated
Was this helpful?