FileLib

object FileLib

Functions

Link copied to clipboard
fun append(fileLocation: String, toAppend: String)

Writes a file to anywhere on the system. Use "./" for the ".minecraft" folder.

fun append(importName: String, fileName: String, toAppend: String)

Writes a file to folder in modules.

Link copied to clipboard
fun decodeBase64(toDecode: String): String

Decodes a base64 string to a string

Link copied to clipboard
fun delete(fileLocation: String): Boolean
fun delete(importName: String, fileName: String): Boolean

Deletes a file at the specified location

Link copied to clipboard
fun deleteDirectory(dir: File): Boolean
fun deleteDirectory(dir: String): Boolean

Deletes a directory at the specified location

Link copied to clipboard
fun encodeBase64(toEncode: String): String

Encodes a string to a base64 string

Link copied to clipboard
fun exists(fileLocation: String): Boolean
fun exists(importName: String, fileName: String): Boolean

Determines if a file or directory exists at the specified location

Link copied to clipboard
fun getUrlContent(theUrl: String, userAgent: String? = "Mozilla/5.0"): String

Gets the contents of a url as a string.

Link copied to clipboard
fun isDirectory(fileLocation: String): Boolean
fun isDirectory(importName: String, fileName: String): Boolean

Determines if a file or directory exists at the specified location

Link copied to clipboard
fun read(file: File): String?

Reads a file from anywhere on the system using java.io.File.

fun read(fileLocation: String): String?

Reads a file from anywhere on the system. Use "./" for the ".minecraft" folder. Returns an empty string if file is not found.

fun read(importName: String, fileName: String): String?

Reads a file from folder in modules. Returns an empty string if file is not found.

Link copied to clipboard
fun unzip(zipFilePath: String, destDirectory: String)

Extracts a zip file specified by the zipFilePath to a directory specified by destDirectory (will be created if does not exist).

Link copied to clipboard
fun write(fileLocation: String, toWrite: String, recursive: Boolean = false)

Writes a file to anywhere on the system. Use "./" for the ".minecraft" folder.

fun write(importName: String, fileName: String, toWrite: String, recursive: Boolean = false)

Writes a file to folder in modules.

Sources

Link copied to clipboard