Liking cljdoc? Tell your friends :D

std.fs.path


directory?clj

(directory? path)

checks whether a file is a directory

(directory? "src") => true

(directory? "project.clj") => false

checks whether a file is a directory

(directory? "src")
=> true

(directory? "project.clj")
=> false
raw docstring

empty-directory?clj

(empty-directory? path)

checks if a directory is empty, returns true if both are true

(empty-directory? ".") => false

checks if a directory is empty, returns true if both are true

(empty-directory? ".")
=> false
raw docstring

executable?clj

(executable? path)

checks whether a file is executable

(executable? "project.clj") => false

(executable? "/usr/bin/whoami") => true

checks whether a file is executable

(executable? "project.clj")
=> false

(executable? "/usr/bin/whoami")
=> true
raw docstring

exists?clj

(exists? path)

checks whether a file exists

(exists? "project.clj") => true

(exists? "NON.EXISTENT") => false

checks whether a file exists

(exists? "project.clj")
=> true

(exists? "NON.EXISTENT")
=> false
raw docstring

fileclj

(file path)

returns the input as a file

(file "project.clj") => java.io.File

returns the input as a file

(file "project.clj")
=> java.io.File
raw docstring

file-nameclj

(file-name x)

returns the last section of the path

(str (file-name "src/hara")) => "hara"

returns the last section of the path

(str (file-name "src/hara"))
=> "hara"
raw docstring

file-suffixclj

(file-suffix file)

encodes the type of file as a keyword

(file-suffix "hello.clj") => :clj

(file-suffix "hello.java") => :java

encodes the type of file as a keyword

(file-suffix "hello.clj")
=> :clj

(file-suffix "hello.java")
=> :java
raw docstring

file-systemclj

(file-system x)

returns the filesystem governing the path

(file-system ".") ;; #object[sun.nio.fs.MacOSXFileSystem 0x512a9870 "sun.nio.fs.MacOSXFileSystem@512a9870"] => java.nio.file.FileSystem

returns the filesystem governing the path

(file-system ".")
;; #object[sun.nio.fs.MacOSXFileSystem 0x512a9870 "sun.nio.fs.MacOSXFileSystem@512a9870"]
=> java.nio.file.FileSystem
raw docstring

file?clj

(file? path)

checks whether a file is not a link or directory

(file? "project.clj") => true

(file? "src") => false

checks whether a file is not a link or directory

(file? "project.clj")
=> true

(file? "src")
=> false
raw docstring

hidden?clj

(hidden? path)

checks whether a file is hidden

(hidden? ".gitignore") => true

(hidden? "project.clj") => false

checks whether a file is hidden

(hidden? ".gitignore")
=> true

(hidden? "project.clj")
=> false
raw docstring

input-streamclj

(input-stream path)
(input-stream path opts)

opens a file as an input-stream

(input-stream "project.clj")

opens a file as an input-stream

(input-stream "project.clj")
raw docstring

last-modifiedclj

(last-modified path)

returns the last modified time as a long

(last-modified "project.clj") => integer?

returns the last modified time as a long

(last-modified "project.clj")
=> integer?
raw docstring

link?clj

(link? path)

checks whether a file is a link

(link? "project.clj") => false

(link? (api/create-symlink "project.lnk" "project.clj")) => true (api/delete "project.lnk")

checks whether a file is a link

(link? "project.clj")
=> false

(link? (api/create-symlink "project.lnk"
                           "project.clj"))
=> true
(api/delete "project.lnk")
raw docstring

normaliseclj

(normalise s)

creates a string that takes notice of the user home

(normalise ".") => (str common/cwd "/" ".")

(normalise "~/hello/world.txt") => (str common/home "/hello/world.txt")

(normalise "/usr/home") => "/usr/home"

creates a string that takes notice of the user home

(normalise ".")
=> (str common/*cwd* "/" ".")

(normalise "~/hello/world.txt")
=> (str common/*home* "/hello/world.txt")

(normalise "/usr/home")
=> "/usr/home"
raw docstring

nth-segmentclj

(nth-segment x i)

returns the nth segment of a given path

(str (nth-segment "/usr/local/bin" 1)) => "local"

returns the nth segment of a given path

(str (nth-segment "/usr/local/bin" 1))
=> "local"
raw docstring

output-streamclj

(output-stream path)
(output-stream path opts)

opens a file as an output-stream

(output-stream "project.clj")

opens a file as an output-stream

(output-stream "project.clj")
raw docstring

parentclj

(parent x)

returns the parent of the given path

(str (parent "/usr/local/bin")) => "/usr/local"

returns the parent of the given path

(str (parent "/usr/local/bin"))
=> "/usr/local"
raw docstring

pathclj

(path x)
(path s & more)

creates a `java.nio.file.Path object

creates a `java.nio.file.Path object
raw docstring

path?clj

(path? x)

checks to see if the object is of type Path

(path? (path "/home")) => true

checks to see if the object is of type Path

(path? (path "/home"))
=> true
raw docstring

permissionsclj

(permissions path)

returns the permissions for a given file

(permissions "src") => "rwxr-xr-x"

returns the permissions for a given file

(permissions "src")
=> "rwxr-xr-x"
raw docstring

read-all-bytesclj

(read-all-bytes path)

opens a file and reads the contents as a byte array

(read-all-bytes "project.clj")

opens a file and reads the contents as a byte array

(read-all-bytes "project.clj")
raw docstring

read-all-linesclj

(read-all-lines path)

opens a file and reads the contents as an array of lines

(read-all-lines "project.clj")

opens a file and reads the contents as an array of lines

(read-all-lines "project.clj")
raw docstring

readable?clj

(readable? path)

checks whether a file is readable

(readable? "project.clj") => true

checks whether a file is readable

(readable? "project.clj")
=> true
raw docstring

relativizeclj

(relativize x other)

returns one path relative to another

(str (relativize "test" "src/hara")) => "../src/hara"

returns one path relative to another

(str (relativize "test" "src/hara"))
=> "../src/hara"
raw docstring

rootclj

(root x)

returns the root path

(str (root "/usr/local/bin")) => "/"

returns the root path

(str (root "/usr/local/bin"))
=> "/"
raw docstring

sectionclj

(section s & more)

path object without normalisation

(str (section "project.clj")) => "project.clj"

(str (section "src" "hara/time.clj")) => "src/hara/time.clj"

path object without normalisation

(str (section "project.clj"))
=> "project.clj"

(str (section "src" "hara/time.clj"))
=> "src/hara/time.clj"
raw docstring

segment-countclj

(segment-count x)

returns the number of segments of a given path

(segment-count "/usr/local/bin") => 3

returns the number of segments of a given path

(segment-count "/usr/local/bin")
=> 3
raw docstring

set-executableclj

(set-executable path)

sets a file to be executable

sets a file to be executable
raw docstring

subpathclj

(subpath x start end)

returns the subpath of a given path

(str (subpath "/usr/local/bin/hello" 1 3)) => "local/bin"

returns the subpath of a given path

(str (subpath "/usr/local/bin/hello" 1 3))
=> "local/bin"
raw docstring

to-fileclj

(to-file path)

creates a java.io.File object

(to-file (section "project.clj")) => (all java.io.File #(-> % str (= "project.clj")))

creates a java.io.File object

(to-file (section "project.clj"))
=> (all java.io.File
        #(-> % str (= "project.clj")))
raw docstring

typestringclj

(typestring path)

returns the shorthand string for a given entry

(typestring "src") => "d"

(typestring "project.clj") => "-"

returns the shorthand string for a given entry

(typestring "src")
=> "d"

(typestring "project.clj")
=> "-"
raw docstring

writable?clj

(writable? path)

checks whether a file is writable

(writable? "project.clj") => true

checks whether a file is writable

(writable? "project.clj")
=> true
raw docstring

write-all-bytesclj

(write-all-bytes path bytes)
(write-all-bytes path bytes opts)

writes a byte-array to file

(write-all-bytes "hello.txt" (.getBytes "Hello World"))

writes a byte-array to file

(write-all-bytes "hello.txt" (.getBytes "Hello World"))
raw docstring

write-intoclj

(write-into path stream)
(write-into path stream opts)

writes a stream to a path

(write-into "project.clj" (java.io.FileInputStream. "project.clj") {:options #{:replace-existing}})

writes a stream to a path

(write-into "project.clj" (java.io.FileInputStream. "project.clj")
            {:options #{:replace-existing}})
raw docstring

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

× close