Liking cljdoc? Tell your friends :D

babashka.fs


absolute?clj

(absolute? f)

Returns true if f represents an absolute path.

Returns true if f represents an absolute path.
sourceraw docstring

absolutizeclj

(absolutize f)

Converts f into an absolute path via Path#toAbsolutePath.

Converts f into an absolute path via Path#toAbsolutePath.
sourceraw docstring

canonicalizeclj

(canonicalize f)
(canonicalize f {:keys [:nofollow-links]})

Returns the canonical path via java.io.File#getCanonicalPath. If :nofollow-links is set, then it will fall back on absolutize + normalize. This function can be used as an alternative to real-path which requires files to exist.

Returns the canonical path via
java.io.File#getCanonicalPath. If `:nofollow-links` is set, then it
will fall back on `absolutize` + `normalize.` This function can be used
as an alternative to `real-path` which requires files to exist.
sourceraw docstring

componentsclj

(components f)

Returns a seq of all components of f as paths, i.e. split on the file separator.

Returns a seq of all components of f as paths, i.e. split on the file
separator.
sourceraw docstring

copyclj

(copy src dest)
(copy src dest {:keys [replace-existing copy-attributes nofollow-links]})

Copies src file to dest dir or file. Options:

  • :replace-existing
  • :copy-attributes
  • :nofollow-links (used to determine to copy symbolic link itself or not).
Copies src file to dest dir or file.
Options:
* `:replace-existing`
* `:copy-attributes`
* `:nofollow-links` (used to determine to copy symbolic link itself or not).
sourceraw docstring

copy-treeclj

(copy-tree src dest)
(copy-tree src
           dest
           {:keys [:replace-existing :copy-attributes :nofollow-links]
            :as opts})

Copies entire file tree from src to dest. Creates dest if needed using create-dirs, passing it the :posix-file-permissions option. Supports same options as copy.

Copies entire file tree from src to dest. Creates dest if needed
using `create-dirs`, passing it the `:posix-file-permissions`
option. Supports same options as copy.
sourceraw docstring

create-dirclj

(create-dir path)
(create-dir path {:keys [:posix-file-permissions]})

Creates dir using Files#createDirectory. Does not create parents.

Creates dir using `Files#createDirectory`. Does not create parents.
sourceraw docstring

create-dirsclj

(create-dirs path)
(create-dirs path {:keys [:posix-file-permissions]})

Creates directories using Files#createDirectories. Also creates parents if needed. Doesn't throw an exception if the dirs exist already. Similar to mkdir -p

Creates directories using `Files#createDirectories`. Also creates parents if needed.
Doesn't throw an exception if the dirs exist already. Similar to `mkdir -p`
sourceraw docstring

create-fileclj

(create-file path)
(create-file path {:keys [:posix-file-permissions]})

Creates empty file using Files#createFile.

File permissions can be specified with an :posix-file-permissions option. String format for posix file permissions is described in the str->posix docstring.

Creates empty file using `Files#createFile`.

File permissions can be specified with an `:posix-file-permissions` option.
String format for posix file permissions is described in the `str->posix` docstring.
sourceraw docstring

(create-link path target)

Create a hard link from path to target.

Create a hard link from path to target.
sourceraw docstring

(create-sym-link path target)

Create a soft link from path to target.

Create a soft link from path to target.
sourceraw docstring

create-temp-dirclj

(create-temp-dir)
(create-temp-dir {:keys [:dir :prefix :posix-file-permissions] :as opts})

Creates a temporary directory using Files#createDirectories.

  • (create-temp-dir): creates temp dir with random prefix.

  • (create-temp-dir {:keys [:dir :prefix :posix-file-permissions]}): create temp dir in dir with prefix. If prefix is not provided, a random one is generated. If path is not provided, the directory is created as if called with (create-temp-dir). File permissions can be specified with an :posix-file-permissions option. String format for posix file permissions is described in the str->posix docstring.

Creates a temporary directory using Files#createDirectories.

- `(create-temp-dir)`: creates temp dir with random prefix.

- `(create-temp-dir {:keys [:dir :prefix :posix-file-permissions]})`:
create temp dir in dir with prefix. If prefix is not provided, a random one
is generated. If path is not provided, the directory is created as if called with `(create-temp-dir)`.
File permissions can be specified with an `:posix-file-permissions` option.
String format for posix file permissions is described in the `str->posix` docstring.
sourceraw docstring

create-temp-fileclj

(create-temp-file)
(create-temp-file {:keys [:dir :prefix :suffix :posix-file-permissions]
                   :as opts})

Creates an empty temporary file using Files#createTempFile.

  • (create-temp-file): creates temp file with random prefix and suffix.

  • (create-temp-dir {:keys [:dir :prefix :suffix :posix-file-permissions]}): create temp file in dir with prefix. If prefix and suffix are not provided, random ones are generated. File permissions can be specified with an :posix-file-permissions option. String format for posix file permissions is described in the str->posix docstring.

Creates an empty temporary file using Files#createTempFile.

- `(create-temp-file)`: creates temp file with random prefix and suffix.

- `(create-temp-dir {:keys [:dir :prefix :suffix :posix-file-permissions]})`:
create temp file in dir with prefix. If prefix and suffix are not provided,
random ones are generated.
File permissions can be specified with an `:posix-file-permissions` option.
String format for posix file permissions is described in the `str->posix` docstring.
sourceraw docstring

creation-timeclj

(creation-time f)
(creation-time f {:keys [nofollow-links] :as opts})

Returns creation time as FileTime.

Returns creation time as FileTime.
sourceraw docstring

cwdclj

(cwd)

Returns current working directory as path

Returns current working directory as path
sourceraw docstring

deleteclj

(delete f)

Deletes f. Returns nil if the delete was successful, throws otherwise. Does not follow symlinks.

Deletes f. Returns nil if the delete was successful,
throws otherwise. Does not follow symlinks.
sourceraw docstring

delete-if-existsclj

(delete-if-exists f)

Deletes f if it exists. Returns true if the delete was successful, false if f didn't exist. Does not follow symlinks.

Deletes f if it exists. Returns true if the delete was successful,
false if f didn't exist. Does not follow symlinks.
sourceraw docstring

delete-on-exitclj

(delete-on-exit f)

Requests delete on exit via File#deleteOnExit. Returns f.

Requests delete on exit via `File#deleteOnExit`. Returns f.
sourceraw docstring

delete-treeclj

(delete-tree root)
(delete-tree root {:keys [force]})

Deletes a file tree using walk-file-tree. Similar to rm -rf. Does not follow symlinks. force ensures read-only directories/files are deleted. Similar to chmod -R +wx + rm -rf

Deletes a file tree using `walk-file-tree`. Similar to `rm -rf`. Does not follow symlinks.
`force` ensures read-only directories/files are deleted. Similar to `chmod -R +wx` + `rm -rf`
sourceraw docstring

directory?clj

(directory? f)
(directory? f {:keys [:nofollow-links]})

Returns true if f is a directory, using Files/isDirectory.

Returns true if f is a directory, using Files/isDirectory.
sourceraw docstring

ends-with?clj

(ends-with? this other)

Returns true if path this ends with path other.

Returns true if path this ends with path other.
sourceraw docstring

exec-pathsclj

(exec-paths)

Returns executable paths (using the PATH environment variable). Same as (split-paths (System/getenv "PATH")).

Returns executable paths (using the PATH environment variable). Same
as `(split-paths (System/getenv "PATH"))`.
sourceraw docstring

executable?clj

(executable? f)

Returns true if f is executable.

Returns true if f is executable.
sourceraw docstring

exists?clj

(exists? f)
(exists? f {:keys [:nofollow-links]})

Returns true if f exists.

Returns true if f exists.
sourceraw docstring

expand-homeclj

(expand-home f)

If path begins with a tilde (~), expand the tilde to the value of the user.home system property. If the path begins with a tilde immediately followed by some characters, they are assumed to be a username. This is expanded to the path to that user's home directory. This is (naively) assumed to be a directory with the same name as the user relative to the parent of the current value of user.home.

If `path` begins with a tilde (`~`), expand the tilde to the value
of the `user.home` system property. If the `path` begins with a
tilde immediately followed by some characters, they are assumed to
be a username. This is expanded to the path to that user's home
directory. This is (naively) assumed to be a directory with the same
name as the user relative to the parent of the current value of
`user.home`.
sourceraw docstring

extensionclj

(extension path)

Returns the extension of a file via split-ext.

Returns the extension of a file via `split-ext`.
sourceraw docstring

fileclj

(file f)
(file f & fs)

Coerces f into a File. Multiple-arg versions treat the first argument as parent and subsequent args as children relative to the parent.

Coerces f into a File. Multiple-arg versions treat the first argument
as parent and subsequent args as children relative to the parent.
sourceraw docstring

file-nameclj

(file-name x)

Returns the name of the file or directory. E.g. (file-name "foo/bar/baz") returns "baz".

Returns the name of the file or directory. E.g. (file-name "foo/bar/baz") returns "baz".
sourceraw docstring

file-separatorclj

source

file-time->instantclj

(file-time->instant ft)

Converts a java.nio.file.attribute.FileTime to a java.time.Instant.

Converts a java.nio.file.attribute.FileTime to a java.time.Instant.
sourceraw docstring

file-time->millisclj

(file-time->millis ft)

Converts a java.nio.file.attribute.FileTime to epoch millis (long).

Converts a java.nio.file.attribute.FileTime to epoch millis (long).
sourceraw docstring

get-attributeclj

(get-attribute path attribute)
(get-attribute path attribute {:keys [:nofollow-links]})
source

globclj

(glob root pattern)
(glob root pattern opts)

Given a file and glob pattern, returns matches as vector of paths. Patterns containing ** or / will cause a recursive walk over path, unless overriden with :recursive. Similarly: :hidden will be enabled (when not set) when pattern starts with a dot. Glob interpretation is done using the rules described in https://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystem.html#getPathMatcher(java.lang.String).

Options:

  • :hidden - match hidden paths. Implied when pattern starts with a dot. Note: on Windows files starting with a dot are not hidden, unless their hidden attribute is set.
  • :follow-links - follow symlinks.
  • :recursive - force recursive search. Implied when pattern contains ** or /.
  • :max-depth - max depth to descend into directory structure.

Examples: (fs/glob "." "**.clj")

Given a file and glob pattern, returns matches as vector of
paths. Patterns containing `**` or `/` will cause a recursive walk over
path, unless overriden with :recursive. Similarly: :hidden will be enabled (when not set)
when `pattern` starts with a dot.
Glob interpretation is done using the rules described in
https://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystem.html#getPathMatcher(java.lang.String).

Options:

* `:hidden` - match hidden paths. Implied when `pattern` starts with a dot. Note: on Windows files starting with a dot are not hidden, unless their hidden attribute is set.
* `:follow-links` - follow symlinks.
* `:recursive` - force recursive search. Implied when `pattern` contains `**` or `/`.
* `:max-depth` - max depth to descend into directory structure.

Examples:
`(fs/glob "." "**.clj")`
sourceraw docstring

gunzipclj

(gunzip gz-file)
(gunzip gz-file dest)
(gunzip gz-file dest {:keys [replace-existing]})

Extracts gz-file to dest directory (default ".").

Options:

  • :replace-existing - true / false: overwrite existing files
Extracts `gz-file` to `dest` directory (default `"."`).

Options:
* `:replace-existing` - `true` / `false`: overwrite existing files
sourceraw docstring

gzipclj

(gzip source-file)
(gzip source-file {:keys [dir out-file] :or {dir "."}})

Gzips source-file and writes the output to dir/out-file. If out-file is not provided, the source-file name with .gz appended is used. If dir is not provided, the current directory is used. Returns the created gzip file.

Gzips `source-file` and writes the output to `dir/out-file`.
If `out-file` is not provided, the `source-file` name with `.gz` appended is used.
If `dir` is not provided, the current directory is used.
Returns the created gzip file.
sourceraw docstring

hidden?clj

(hidden? f)

Returns true if f is hidden.

Returns true if f is hidden.
sourceraw docstring

homeclj

(home)
(home user)

With no arguments, returns the current value of the user.home system property. If a user is passed, returns that user's home directory as found in the parent of home with no args.

With no arguments, returns the current value of the `user.home`
system property. If a `user` is passed, returns that user's home
directory as found in the parent of home with no args.
sourceraw docstring

instant->file-timeclj

(instant->file-time instant)

Converts a java.time.Instant to a java.nio.file.attribute.FileTime.

Converts a java.time.Instant to a java.nio.file.attribute.FileTime.
sourceraw docstring

last-modified-timeclj

(last-modified-time f)
(last-modified-time f {:keys [nofollow-links] :as opts})

Returns last modified time as a java.nio.file.attribute.FileTime.

Returns last modified time as a java.nio.file.attribute.FileTime.
sourceraw docstring

list-dirclj

(list-dir dir)
(list-dir dir glob-or-accept)

Returns all paths in dir as vector. For descending into subdirectories use glob.

  • glob-or-accept - a glob string such as "*.edn" or a (fn accept [^java.nio.file.Path p]) -> truthy
Returns all paths in dir as vector. For descending into subdirectories use `glob.`
- `glob-or-accept` - a glob string such as "*.edn" or a (fn accept [^java.nio.file.Path p]) -> truthy
sourceraw docstring

list-dirsclj

(list-dirs dirs glob-or-accept)

Similar to list-dir but accepts multiple roots and returns the concatenated results.

  • glob-or-accept - a glob string such as "*.edn" or a (fn accept [^java.nio.file.Path p]) -> truthy
Similar to list-dir but accepts multiple roots and returns the concatenated results.
- `glob-or-accept` - a glob string such as "*.edn" or a (fn accept [^java.nio.file.Path p]) -> truthy
sourceraw docstring

matchclj

(match root pattern)
(match root pattern {:keys [hidden follow-links max-depth recursive]})

Given a file and match pattern, returns matches as vector of paths. Pattern interpretation is done using the rules described in https://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystem.html#getPathMatcher(java.lang.String).

Options:

  • :hidden - match hidden paths - note: on Windows paths starting with a dot are not hidden, unless their hidden attribute is set.
  • :follow-links - follow symlinks.
  • :recursive - match recursively.
  • :max-depth - max depth to descend into directory structure.

Examples: (fs/match "." "regex:.*\\.clj" {:recursive true})

Given a file and match pattern, returns matches as vector of
paths. Pattern interpretation is done using the rules described in
https://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystem.html#getPathMatcher(java.lang.String).

Options:

* `:hidden` - match hidden paths - note: on Windows paths starting with
a dot are not hidden, unless their hidden attribute is set.
* `:follow-links` - follow symlinks.
* `:recursive` - match recursively.
* `:max-depth` - max depth to descend into directory structure.

Examples:
`(fs/match "." "regex:.*\\.clj" {:recursive true})`
sourceraw docstring

millis->file-timeclj

(millis->file-time millis)

Converts epoch millis (long) to a java.nio.file.attribute.FileTime.

Converts epoch millis (long) to a java.nio.file.attribute.FileTime.
sourceraw docstring

modified-sinceclj

(modified-since anchor file-set)

Returns seq of regular files (non-directories, non-symlinks) from file-set that were modified since the anchor path. The anchor path can be a regular file or directory, in which case the recursive max last modified time stamp is used as the timestamp to compare with. The file-set may be a regular file, directory or collection of files (e.g. returned by glob). Directories are searched recursively.

Returns seq of regular files (non-directories, non-symlinks) from file-set that were modified since the anchor path.
The anchor path can be a regular file or directory, in which case
the recursive max last modified time stamp is used as the timestamp
to compare with.  The file-set may be a regular file, directory or
collection of files (e.g. returned by glob). Directories are
searched recursively.
sourceraw docstring

moveclj

(move source target)
(move source target {:keys [:replace-existing :atomic-move :nofollow-links]})

Move or rename a file to a target dir or file via Files/move.

Move or rename a file to a target dir or file via `Files/move`.
sourceraw docstring

normalizeclj

(normalize f)

Normalizes f via Path#normalize.

Normalizes f via Path#normalize.
sourceraw docstring

ownerclj

(owner f)
(owner f {:keys [:nofollow-links]})

Returns the owner of a file. Call str on it to get the owner name as a string.

Returns the owner of a file. Call `str` on it to get the owner name
as a string.
sourceraw docstring

parentclj

(parent f)

Returns parent of f. Akin to dirname in bash.

Returns parent of f. Akin to `dirname` in bash.
sourceraw docstring

pathclj

(path f)
(path parent child)
(path parent child & more)

Coerces f into a Path. Multiple-arg versions treat the first argument as parent and subsequent args as children relative to the parent.

Coerces f into a Path. Multiple-arg versions treat the first argument as
parent and subsequent args as children relative to the parent.
sourceraw docstring

path-separatorclj

source

posix->strclj

(posix->str p)

Converts a set of PosixFilePermission to a string.

Converts a set of PosixFilePermission to a string.
sourceraw docstring

posix-file-permissionsclj

source

read-all-bytesclj

(read-all-bytes f)

Returns contents of file as byte array.

Returns contents of file as byte array.
sourceraw docstring

read-all-linesclj

(read-all-lines f)
(read-all-lines f {:keys [charset] :or {charset "utf-8"}})

Read all lines from a file.

Read all lines from a file.
sourceraw docstring

read-attributesclj

(read-attributes path attributes)
(read-attributes path attributes {:keys [:nofollow-links :key-fn] :as opts})

Same as read-attributes* but turns attributes into a map and keywordizes keys. Keywordizing can be changed by passing a :key-fn in the options map.

Same as `read-attributes*` but turns attributes into a map and keywordizes keys.
Keywordizing can be changed by passing a :key-fn in the options map.
sourceraw docstring

read-attributes*clj

(read-attributes* path attributes)
(read-attributes* path attributes {:keys [:nofollow-links]})

Reads attributes via Files/readAttributes.

Reads attributes via Files/readAttributes.
sourceraw docstring

(read-link path)

Reads the target of a symbolic link. The target need not exist.

Reads the target of a symbolic link. The target need not exist.
sourceraw docstring

readable?clj

(readable? f)

Returns true if f is readable

Returns true if f is readable
sourceraw docstring

real-pathclj

(real-path f)
(real-path f {:keys [:nofollow-links]})

Converts f into real path via Path#toRealPath.

Converts f into real path via Path#toRealPath.
sourceraw docstring

regular-file?clj

(regular-file? f)
(regular-file? f {:keys [:nofollow-links]})

Returns true if f is a regular file, using Files/isRegularFile.

Returns true if f is a regular file, using Files/isRegularFile.
sourceraw docstring

relative?clj

(relative? f)

Returns true if f represents a relative path.

Returns true if f represents a relative path.
sourceraw docstring

relativizeclj

(relativize this other)

Returns relative path by comparing this with other.

Returns relative path by comparing this with other.
sourceraw docstring

same-file?clj

(same-file? this other)

Returns true if this is the same file as other.

Returns true if this is the same file as other.
sourceraw docstring

set-attributeclj

(set-attribute path attribute value)
(set-attribute path attribute value {:keys [:nofollow-links]})
source

set-creation-timeclj

(set-creation-time f time)
(set-creation-time f time {:keys [nofollow-links] :as opts})

Sets creation time of f to time (millis, java.time.Instant or java.nio.file.attribute.FileTime).

Sets creation time of f to time (millis, java.time.Instant or java.nio.file.attribute.FileTime).
sourceraw docstring

set-last-modified-timeclj

(set-last-modified-time f time)
(set-last-modified-time f time {:keys [nofollow-links] :as opts})

Sets last modified time of f to time (millis, java.time.Instant or java.nio.file.attribute.FileTime).

Sets last modified time of f to time (millis, java.time.Instant or java.nio.file.attribute.FileTime).
sourceraw docstring

set-posix-file-permissionsclj

source

sizeclj

(size f)

Returns the size of a file (in bytes).

Returns the size of a file (in bytes).
sourceraw docstring

split-extclj

(split-ext path)
(split-ext path {:keys [ext]})

Splits path on extension If provided, a specific extension ext, the extension (without dot), will be used for splitting. Directories are not processed.

Splits path on extension If provided, a specific extension `ext`, the
extension (without dot), will be used for splitting.  Directories
are not processed.
sourceraw docstring

split-pathsclj

(split-paths joined-paths)

Splits a path list given as a string joined by the OS-specific path-separator into a vec of paths. On UNIX systems, the separator is ':', on Microsoft Windows systems it is ';'.

Splits a path list given as a string joined by the OS-specific path-separator into a vec of paths.
On UNIX systems, the separator is ':', on Microsoft Windows systems it is ';'.
sourceraw docstring

starts-with?clj

(starts-with? this other)

Returns true if path this starts with path other.

Returns true if path this starts with path other.
sourceraw docstring

str->posixclj

(str->posix s)

Converts a string to a set of PosixFilePermission.

s is a string like "rwx------".

Converts a string to a set of PosixFilePermission.

`s` is a string like `"rwx------"`.
sourceraw docstring

strip-extclj

(strip-ext path)
(strip-ext path {:keys [ext] :as opts})

Strips extension via split-ext.

Strips extension via `split-ext`.
sourceraw docstring

sym-link?clj

(sym-link? f)

Determines if f is a symbolic link via java.nio.file.Files/isSymbolicLink.

Determines if `f` is a symbolic link via `java.nio.file.Files/isSymbolicLink`.
sourceraw docstring

temp-dirclj

(temp-dir)

Returns java.io.tmpdir property as path.

Returns `java.io.tmpdir` property as path.
sourceraw docstring

unixifyclj

(unixify f)

Returns path as string with Unix-style file separators (/).

Returns path as string with Unix-style file separators (`/`).
sourceraw docstring

unzipclj

(unzip zip-file)
(unzip zip-file dest)
(unzip zip-file dest {:keys [replace-existing]})

Unzips zip-file to dest directory (default ".").

Options:

  • :replace-existing - true / false: overwrite existing files
Unzips `zip-file` to `dest` directory (default `"."`).

Options:
* `:replace-existing` - `true` / `false`: overwrite existing files
sourceraw docstring

update-fileclj

(update-file file f & xs)
(update-file file opts f & xs)

Updates the contents of text file path using f applied to old contents and xs. Returns the new contents.

Options:

  • :charset - charset of file, default to "utf-8"
Updates the contents of text file `path` using `f` applied to old contents and `xs`.
Returns the new contents.

Options:

* `:charset` - charset of file, default to "utf-8"
sourceraw docstring

walk-file-treeclj

(walk-file-tree f
                {:keys [:pre-visit-dir :post-visit-dir :visit-file
                        :visit-file-failed :follow-links :max-depth]})

Walks f using Files/walkFileTree. Visitor functions: :pre-visit-dir, :post-visit-dir, :visit-file, :visit-file-failed. All visitor functions default to (constantly :continue). Supported return values: :continue, :skip-subtree, :skip-siblings, :terminate. A different return value will throw.

Walks f using Files/walkFileTree. Visitor functions: :pre-visit-dir,
:post-visit-dir, :visit-file, :visit-file-failed. All visitor functions
default to (constantly :continue). Supported return
values: :continue, :skip-subtree, :skip-siblings, :terminate. A
different return value will throw.
sourceraw docstring

whichclj

(which program)
(which program opts)

Returns Path to first executable program found in :paths opt, similar to the which Unix command. Default for :paths is (exec-paths).

On Windows, searches for program with filename extensions specified in :win-exts opt. Default is ["com" "exe" "bat" "cmd"]. If program already includes an extension from :win-exts, it will be searched as-is first.

When program is a relative or absolute path, :paths is not consulted. On Windows, the :win-exts variants are still searched. On other OSes, the path for program will be returned if executable, else nil.

Returns Path to first executable `program` found in `:paths` `opt`, similar to the which Unix command.
Default for `:paths` is `(exec-paths)`.

On Windows, searches for `program` with filename extensions specified in `:win-exts` `opt`.
Default is `["com" "exe" "bat" "cmd"]`.
If `program` already includes an extension from `:win-exts`, it will be searched as-is first.

When `program` is a relative or absolute path, `:paths` is not consulted. On Windows, the `:win-exts`
variants are still searched. On other OSes, the path for `program` will be returned if executable,
else nil.
sourceraw docstring

which-allclj

(which-all program)
(which-all program opts)

Returns every Path to program found in (exec-paths). See which.

Returns every Path to `program` found in (`exec-paths`). See `which`.
sourceraw docstring

windows?clj

(windows?)

Returns true if OS is Windows.

Returns true if OS is Windows.
sourceraw docstring

with-temp-dircljmacro

(with-temp-dir [binding-name options] & body)

Evaluate body with binding-name bound to a temporary directory.

The directory is created by passing options to create-temp-dir, and will be removed with delete-tree on exit from the scope.

options is a map with the keys as for create-temp-dir.

Evaluate body with binding-name bound to a temporary directory.

The directory is created by passing `options` to `create-temp-dir`,
and will be removed with `delete-tree` on exit from the scope.

`options` is a map with the keys as for create-temp-dir.
sourceraw docstring

writable?clj

(writable? f)

Returns true if f is writable

Returns true if f is writable
sourceraw docstring

write-bytesclj

(write-bytes path bytes)
(write-bytes path
             bytes
             {:keys [append create truncate-existing write] :as opts})

Writes bytes to path via java.nio.file.Files/write. Supported options:

  • :create (default true)
  • :truncate-existing (default true)
  • :write (default true)
  • :append (default false)
  • or any java.nio.file.StandardOption.

Examples:

(fs/write-bytes f (.getBytes (String. "foo"))) ;; overwrites + truncates or creates new file
(fs/write-bytes f (.getBytes (String. "foo")) {:append true})
Writes `bytes` to `path` via `java.nio.file.Files/write`.
Supported options:
* `:create` (default `true`)
* `:truncate-existing` (default `true`)
* `:write` (default `true`)
* `:append` (default `false`)
* or any `java.nio.file.StandardOption`.

Examples:

``` clojure
(fs/write-bytes f (.getBytes (String. "foo"))) ;; overwrites + truncates or creates new file
(fs/write-bytes f (.getBytes (String. "foo")) {:append true})
```
sourceraw docstring

write-linesclj

(write-lines path lines)
(write-lines path lines {:keys [charset] :or {charset "utf-8"} :as opts})

Writes lines, a seqable of strings to path via java.nio.file.Files/write.

Supported options:

  • :charset (default "utf-8")

Supported open options:

  • :create (default true)
  • :truncate-existing (default true)
  • :write (default true)
  • :append (default false)
  • or any java.nio.file.StandardOption.
Writes `lines`, a seqable of strings to `path` via `java.nio.file.Files/write`.

Supported options:
* `:charset` (default `"utf-8"`)

Supported open options:
* `:create` (default `true`)
* `:truncate-existing` (default `true`)
* `:write` (default `true`)
* `:append` (default `false`)
* or any `java.nio.file.StandardOption`.
sourceraw docstring

xdg-cache-homeclj

(xdg-cache-home)
(xdg-cache-home app)

Path representing the base directory relative to which user-specific non-essential data files should be stored as described in the XDG Base Directory Specification.

Returns path based on the value of env-var XDG_CACHE_HOME (if set and representing an absolute path), else (fs/path (fs/home) ".cache"). When provided, appends app to the path.

Path representing the base directory relative to which user-specific non-essential data files should be stored as described in the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html).

Returns path based on the value of env-var `XDG_CACHE_HOME` (if set and representing an absolute path), else `(fs/path (fs/home) ".cache")`.
When provided, appends `app` to the path.
sourceraw docstring

xdg-config-homeclj

(xdg-config-home)
(xdg-config-home app)

Path representing the base directory relative to which user-specific configuration files should be stored as described in the XDG Base Directory Specification.

Returns path based on the value of env-var XDG_CONFIG_HOME (if set and representing an absolute path), else (fs/path (fs/home) ".config"). When provided, appends app to the path.

Path representing the base directory relative to which user-specific configuration files should be stored as described in the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html).

Returns path based on the value of env-var `XDG_CONFIG_HOME` (if set and representing an absolute path), else `(fs/path (fs/home) ".config")`.
When provided, appends `app` to the path.
sourceraw docstring

xdg-data-homeclj

(xdg-data-home)
(xdg-data-home app)

Path representing the base directory relative to which user-specific data files should be stored as described in the XDG Base Directory Specification.

Returns path based on the value of env-var XDG_DATA_HOME (if set and representing an absolute path), else (fs/path (fs/home) ".local" "share"). When provided, appends app to the path.

Path representing the base directory relative to which user-specific data files should be stored as described in the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html).

Returns path based on the value of env-var `XDG_DATA_HOME` (if set and representing an absolute path), else `(fs/path (fs/home) ".local" "share")`.
When provided, appends `app` to the path.
sourceraw docstring

xdg-state-homeclj

(xdg-state-home)
(xdg-state-home app)

Path representing the base directory relative to which user-specific state files should be stored as described in the XDG Base Directory Specification.

Returns path based on the value of env-var XDG_STATE_HOME (if set and representing an absolute path), else (fs/path (fs/home) ".local" "state"). When provided, appends app to the path.

Path representing the base directory relative to which user-specific state files should be stored as described in the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html).

Returns path based on the value of env-var `XDG_STATE_HOME` (if set and representing an absolute path), else `(fs/path (fs/home) ".local" "state")`.
When provided, appends `app` to the path.
sourceraw docstring

zipclj

(zip zip-file entries)
(zip zip-file entries opts)

Zips entry or entries into zip-file. An entry may be a file or directory. Directories are included recursively and their names are preserved in the zip file. Currently only accepts relative entries.

Options:

  • :root: directory which will be elided in zip. E.g.: (fs/zip ["src"] {:root "src"})
  • :path-fn: a single-arg function from file system path to zip entry path.
Zips entry or entries into zip-file. An entry may be a file or
directory. Directories are included recursively and their names are
preserved in the zip file. Currently only accepts relative entries.

Options:
* `:root`: directory which will be elided in zip. E.g.: `(fs/zip ["src"] {:root "src"})`
* `:path-fn`: a single-arg function from file system path to zip entry path.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close