datoteka.fs

File System helpers.

*cwd*

dynamic

*home*

dynamic

*os-name*

dynamic

*sep*

dynamic

*system*

dynamic

*tmp-dir*

dynamic

absolute

(absolute path)

Return absolute path.

absolute?

(absolute? path)

Checks if the provided path is absolute.

base

(base path)

Return the base part of a file.

create-dir

(create-dir path)(create-dir path perms)

Create a new directory.

create-tempdir

(create-tempdir)(create-tempdir prefix)

Creates a temp directory on the filesystem.

create-tempfile

(create-tempfile & {:keys [suffix prefix]})

Create a temporal file.

delete

(delete path)

Delete recursiverly a directory or file.

directory?

(directory? path)(directory? path params)

Checks if the provided path is a directory.

executable?

(executable? path)

Checks if the provided path is executable.

exists?

(exists? path)(exists? path params)

Check if the provided path exists.

ext

(ext path)

Return the extension part of a file.

file

(file path)

Converts the path to a java.io.File instance.

file?

(file? v)

Check if v is an instance of java.io.File

hidden?

(hidden? path)

Check if the provided path is hidden.

join

(join base path)(join base path & more)

Resolve path on top of an other path.

last-modified-time

(last-modified-time path)(last-modified-time path params)

link?

(link? path)

Checks if the provided path is a link.

list-dir

(list-dir path)(list-dir path glob)

Return a lazy seq of files and directories found under the provided directory. The order of files is not guarrantied.

NOTE: the seq should be fully realized in order to properly release all acquired resources for this operation. Converting it to vector is an option for do it.

make-permissions

(make-permissions expr)

Generate a array of FileAttribute instances generated from rwxr-xr-x kind of expressions.

move

(move src dst)(move src dst flags)

Move or rename a file to a target file.

By default, this method attempts to move the file to the target file, failing if the target file exists except if the source and target are the same file, in which case this method has no effect. If the file is a symbolic link then the symbolic link itself, not the target of the link, is moved.

This method may be invoked to move an empty directory. When invoked to move a directory that is not empty then the directory is moved if it does not require moving the entries in the directory. For example, renaming a directory on the same FileStore will usually not require moving the entries in the directory. When moving a directory requires that its entries be moved then this method fails (by throwing an IOException).

name

(name path)

Return a path representing the name of the file or directory, or null if this path has zero elements.

normalize

(normalize path)

Normalize the path.

parent

(parent path)

Get parent path if it exists.

path

(path fst)(path fst & more)

Create path from string or more than one string.

path->input-stream

(path->input-stream path)

path->output-stream

(path->output-stream path)

path?

(path? v)

Return true if provided value is an instance of Path.

permissions

(permissions path)(permissions path params)

Returns the string representation of the permissions of the provided path.

readable?

(readable? path)

Check if the provided path is readable.

real

(real path)(real path params)

Converts f into real path via Path#toRealPath.

regular-file?

(regular-file? path)(regular-file? path params)

Checks if the provided path is a plain file.

relative?

(relative? path)

Check if the provided path is relative.

relativize

(relativize base other)

Returns the relationship between two paths.

size

(size path)

Return the file size.

split-ext

(split-ext path)

Returns a vector of [^String name ^String extension].

tempfile

(tempfile & {:keys [suffix prefix max-retries], :or {suffix ".tmp", max-retries 1000, prefix "datoteka."}})

Retrieves a candidate tempfile (without creating it).

writable?

(writable? path)

Check if the provided path is writable.