interface FileSystem
Contains a broad set of operations for manipulating files on the file system.
A (potential) blocking and non blocking version of each operation is provided.
The non blocking versions take a handler which is called when the operation completes or an error occurs.
The blocking versions are named xxxBlocking and return the results, or throw exceptions directly. In many cases, depending on the operating system and file system some of the potentially blocking operations can return quickly, which is why we provide them, but it's highly recommended that you test how long they take to return in your particular application before using them on an event loop.
Please consult the documentation for more information on file system support.
Author
Tim Fox
abstract fun chmod(path: String, perms: String, handler: Handler<AsyncResult<Void>>): FileSystem
Change the permissions on the file represented by The permission String takes the form rwxr-x--- as specified here. |
|
abstract fun chmodBlocking(path: String, perms: String): FileSystem
Blocking version of |
|
abstract fun chmodRecursive(path: String, perms: String, dirPerms: String, handler: Handler<AsyncResult<Void>>): FileSystem
Change the permissions on the file represented by The permission String takes the form rwxr-x--- as specified in {here}. If the file is directory then all contents will also have their permissions changed recursively. Any directory permissions will be set to |
|
abstract fun chmodRecursiveBlocking(path: String, perms: String, dirPerms: String): FileSystem
Blocking version of |
|
abstract fun chown(path: String, user: String, group: String, handler: Handler<AsyncResult<Void>>): FileSystem
Change the ownership on the file represented by |
|
abstract fun chownBlocking(path: String, user: String, group: String): FileSystem
Blocking version of |
|
abstract fun copy(from: String, to: String, handler: Handler<AsyncResult<Void>>): FileSystem
Copy a file from the path The copy will fail if the destination already exists. abstract fun copy(from: String, to: String, options: CopyOptions, handler: Handler<AsyncResult<Void>>): FileSystem
Copy a file from the path |
|
abstract fun copyBlocking(from: String, to: String): FileSystem
Blocking version of |
|
abstract fun copyRecursive(from: String, to: String, recursive: Boolean, handler: Handler<AsyncResult<Void>>): FileSystem
Copy a file from the path If The copy will fail if the destination if the destination already exists. |
|
abstract fun copyRecursiveBlocking(from: String, to: String, recursive: Boolean): FileSystem
Blocking version of |
|
abstract fun createFile(path: String, handler: Handler<AsyncResult<Void>>): FileSystem
Creates an empty file with the specified abstract fun createFile(path: String, perms: String, handler: Handler<AsyncResult<Void>>): FileSystem
Creates an empty file with the specified |
|
abstract fun createFileBlocking(path: String): FileSystem
Blocking version of abstract fun createFileBlocking(path: String, perms: String): FileSystem
Blocking version of |
|
abstract fun delete(path: String, handler: Handler<AsyncResult<Void>>): FileSystem
Deletes the file represented by the specified |
|
abstract fun deleteBlocking(path: String): FileSystem
Blocking version of |
|
abstract fun deleteRecursive(path: String, recursive: Boolean, handler: Handler<AsyncResult<Void>>): FileSystem
Deletes the file represented by the specified If the path represents a directory and |
|
abstract fun deleteRecursiveBlocking(path: String, recursive: Boolean): FileSystem
Blocking version of |
|
abstract fun exists(path: String, handler: Handler<AsyncResult<Boolean>>): FileSystem
Determines whether the file as specified by the path |
|
abstract fun existsBlocking(path: String): Boolean
Blocking version of |
|
abstract fun fsProps(path: String, handler: Handler<AsyncResult<FileSystemProps>>): FileSystem
Returns properties of the file-system being used by the specified |
|
abstract fun fsPropsBlocking(path: String): FileSystemProps
Blocking version of |
|
abstract fun link(link: String, existing: String, handler: Handler<AsyncResult<Void>>): FileSystem
Create a hard link on the file system from |
|
abstract fun linkBlocking(link: String, existing: String): FileSystem
Blocking version of |
|
abstract fun lprops(path: String, handler: Handler<AsyncResult<FileProps>>): FileSystem
Obtain properties for the link represented by The link will not be followed. |
|
abstract fun lpropsBlocking(path: String): FileProps
Blocking version of |
|
abstract fun mkdir(path: String, handler: Handler<AsyncResult<Void>>): FileSystem
Create the directory represented by The operation will fail if the directory already exists. abstract fun mkdir(path: String, perms: String, handler: Handler<AsyncResult<Void>>): FileSystem
Create the directory represented by The new directory will be created with permissions as specified by The permission String takes the form rwxr-x--- as specified in here. The operation will fail if the directory already exists. |
|
abstract fun mkdirBlocking(path: String): FileSystem
Blocking version of abstract fun mkdirBlocking(path: String, perms: String): FileSystem
Blocking version of |
|
abstract fun mkdirs(path: String, handler: Handler<AsyncResult<Void>>): FileSystem
Create the directory represented by The operation will fail if the directory already exists. abstract fun mkdirs(path: String, perms: String, handler: Handler<AsyncResult<Void>>): FileSystem
Create the directory represented by The new directory will be created with permissions as specified by The permission String takes the form rwxr-x--- as specified in here. The operation will fail if the directory already exists. |
|
abstract fun mkdirsBlocking(path: String): FileSystem
Blocking version of abstract fun mkdirsBlocking(path: String, perms: String): FileSystem
Blocking version of |
|
abstract fun move(from: String, to: String, handler: Handler<AsyncResult<Void>>): FileSystem
Move a file from the path The move will fail if the destination already exists. abstract fun move(from: String, to: String, options: CopyOptions, handler: Handler<AsyncResult<Void>>): FileSystem
Move a file from the path |
|
abstract fun moveBlocking(from: String, to: String): FileSystem
Blocking version of |
|
abstract fun open(path: String, options: OpenOptions, handler: Handler<AsyncResult<AsyncFile>>): FileSystem
Open the file represented by The file is opened for both reading and writing. If the file does not already exist it will be created. |
|
abstract fun openBlocking(path: String, options: OpenOptions): AsyncFile
Blocking version of |
|
abstract fun props(path: String, handler: Handler<AsyncResult<FileProps>>): FileSystem
Obtain properties for the file represented by If the file is a link, the link will be followed. |
|
abstract fun propsBlocking(path: String): FileProps
Blocking version of |
|
abstract fun readDir(path: String, handler: Handler<AsyncResult<MutableList<String>>>): FileSystem
Read the contents of the directory specified by The result is an array of String representing the paths of the files inside the directory. abstract fun readDir(path: String, filter: String, handler: Handler<AsyncResult<MutableList<String>>>): FileSystem
Read the contents of the directory specified by The parameter The result is an array of String representing the paths of the files inside the directory. |
|
abstract fun readDirBlocking(path: String): MutableList<String>
Blocking version of abstract fun readDirBlocking(path: String, filter: String): MutableList<String>
Blocking version of |
|
abstract fun readFile(path: String, handler: Handler<AsyncResult<Buffer>>): FileSystem
Reads the entire file as represented by the path Do not use this method to read very large files or you risk running out of available RAM. |
|
abstract fun readFileBlocking(path: String): Buffer
Blocking version of |
|
abstract fun readSymlink(link: String, handler: Handler<AsyncResult<String>>): FileSystem
Returns the path representing the file that the symbolic link specified by |
|
abstract fun readSymlinkBlocking(link: String): String
Blocking version of |
|
abstract fun symlink(link: String, existing: String, handler: Handler<AsyncResult<Void>>): FileSystem
Create a symbolic link on the file system from |
|
abstract fun symlinkBlocking(link: String, existing: String): FileSystem
Blocking version of |
|
abstract fun truncate(path: String, len: Long, handler: Handler<AsyncResult<Void>>): FileSystem
Truncate the file represented by The operation will fail if the file does not exist or |
|
abstract fun truncateBlocking(path: String, len: Long): FileSystem
Blocking version of |
|
abstract fun unlink(link: String, handler: Handler<AsyncResult<Void>>): FileSystem
Unlinks the link on the file system represented by the path |
|
abstract fun unlinkBlocking(link: String): FileSystem
Blocking version of |
|
abstract fun writeFile(path: String, data: Buffer, handler: Handler<AsyncResult<Void>>): FileSystem
Creates the file, and writes the specified |
|
abstract fun writeFileBlocking(path: String, data: Buffer): FileSystem
Blocking version of |