vertx.filesystem.sync documentation

Provides a broad set of functions for manipulating files. Wraps the
synchronous methods from org.vertx.java.core.file.FileSystem.

chmod

(chmod path perms)(chmod path perms dir-perms)
Change the permissions on the file represented path to perms, synchronously.
If dir-perms is provided and path is a directory, it will have its
permisions changed recursively, with perms being applied to any
files, and dir-perms being applied to directories.

The permission strings take the form rwxr-x--- as specified by
http://download.oracle.com/javase/7/docs/api/java/nio/file/attribute/PosixFilePermissions.html

copy

(copy src dest)(copy src dest recursive?)
Copy a file from the src path to dest path, synchronously.
If recursive? is true and src represents a directory, then the
directory and its contents will be copied recursively to
dest. recursive? defaults to false. 

The copy will fail if the destination already exists.

create-file

(create-file path)(create-file path perms)
Creates an empty file with the specified path, synchronously.
If perms are provided, they will override the default permissions
for the created file. The permission String takes the form
rwxr-x--- as specified by:
http://download.oracle.com/javase/7/docs/api/java/nio/file/attribute/PosixFilePermissions.html

delete

(delete path)(delete path recursive?)
Deletes the file on the file system represented by path, synchronously.

If the recursive? is true (default is false) and file is a
directory, it will be deleted recursively.

exists?

(exists? path)
Determines whether the file as specified by the path {@code path} exists, synchronously.

file-system-properties

(file-system-properties path)
Returns properties of the file-system being used by the specified path, synchronously.
can either be a two-arity fn that will be passed the
exception (if any) and properties (as a map) from the result of the
call, or a that will be called with the AsyncResult object
that wraps the exception and FileSystemProps object.

mkdir

(mkdir path)(mkdir path create-parents?)(mkdir path create-parents? perms)
Create the directory represented by path, synchronously.
If create-parents? is true (default is false), any non-existent
parent directories of the directory will also be created.  If perms
are provided, they will override the default permissions for the
created directory. The permission String takes the form rwxr-x---
as specified by:
http://download.oracle.com/javase/7/docs/api/java/nio/file/attribute/PosixFilePermissions.html

The operation will fail if the directory already exists.

move

(move src dest)
Move a file from the src path to dest path, synchronously.

The move will fail if the destination already exists.

open

(open path & {:keys [perms read? write? create? flush?], :or {read? true, write? true, create? true}})
Open the file represented by path, synchronously.
Returns an AsyncFile instance.

The behavior of the open call is further controlled by a set of
kwarg arguments [default]:

* create? - create the file if it does not already exist [true]
* read?   - open the file for reading [true]
* write?  - open the file for writing [true]
* flush?  - the opened file will auto-flush writes [false]
* perms   - the permissions used to create the file, if necessary
            (see create-file) [nil]

properties

(properties path)(properties path follow-link?)
Obtain properties for the file represented by path, synchronously.

The returned properties map will contain :creation-time,
:last-access-time, :last-modified-time, :directory?, :regular-file?,
:symbolic-link?, :other?, and :size.

If the follow-link? is true (the default) and file is a link, the
link will be followed.

read-dir

(read-dir path)(read-dir path filter)
Read the contents of the directory specified by path, synchronously.
If a filter regex is specified then only the paths that match it
will be returned.

read-file

(read-file path)
Reads the entire file as represented by the path path as a Buffer, synchronously.

Do not user this method to read very large files or you
risk running out of available RAM.

truncate

(truncate path len)
Truncate the file represented by path to length len in bytes, synchronously.

The truncate will fail if the file does not exist or len is less
than zero.

write-file

(write-file path data)
Creates the file, and writes the specified data to the file represented by path, synchronously.