Liking cljdoc? Tell your friends :D

tools.io


->file-pathclj

(->file-path filename)
source

as-file!clj

(as-file! f)

coerce argument to an io/file. argument could be a string, an io/file or an io/resource

coerce argument to an io/file.
argument could be a string, an io/file or an io/resource
sourceraw docstring

basenameclj

(basename path)

Return the basename of a file path

(basename "/foo/bar.gz") ; => "bar.gz" (basename "http://www.foo.com/qux/") ; => "qux"

Return the basename of a file path

(basename "/foo/bar.gz") ; => "bar.gz"
(basename "http://www.foo.com/qux/") ; => "qux"
sourceraw docstring

copyclj

(copy from from-opts to to-opts)
(copy from from-opts to to-opts copy-opts)

Copy content of file to another file. The only key for copy-opts is :buffer-size that precises the buffer size used between reader and writer. This function may not be the optimal way to copy a file.

Copy content of file to another file. The only key for copy-opts is :buffer-size that precises the buffer size
used between reader and writer.
This function may not be the optimal way to copy a file.
sourceraw docstring

exists?clj

(exists? filename & [options])

Return true if a file exists

(exists? "--i-dont-exists--") ; => false (exists? "https://www.oscaro.com/") ; => true

Return true if a file exists

(exists? "--i-dont-exists--") ; => false
(exists? "https://www.oscaro.com/") ; => true
sourceraw docstring

expand-homeclj

(expand-home path)
source

join-pathclj

(join-path x)
(join-path x & xs)

Join multiple parts of a path into one.

(join-path "gs://foo" "bar") ; => "gs://foo/bar" (join-path "gs://foo/" "bar") ; => "gs://foo/bar"

Join multiple parts of a path into one.

(join-path "gs://foo" "bar")  ; => "gs://foo/bar"
(join-path "gs://foo/" "bar") ; => "gs://foo/bar"
sourceraw docstring

line-writeclj

(line-write {:keys [stream] :as _file} line)

Write one line in a file created with tools.io.core/file-writer. It is the caller's responsibility to close the file using tools.io.core/close! when it’s done.

Write one line in a file created with tools.io.core/file-writer. It is the
caller's responsibility to close the file using tools.io.core/close! when
it’s done.
sourceraw docstring

lines-writeclj

(lines-write file lines)

Write lines in a file created with tools.io.core/file-writer and close it

Write lines in a file created with tools.io.core/file-writer and close it
sourceraw docstring

list-dirscljmultimethod

(list-dirs path & [options])

Alias of tools.io.core/list-dirs.

Alias of tools.io.core/list-dirs.
sourceraw docstring

list-filescljmultimethod

(list-files path & [options])

Alias of tools.io.core/list-files for backward compatibility.

Alias of tools.io.core/list-files for backward compatibility.
sourceraw docstring

load-config-fileclj

(load-config-file filename)
(load-config-file filename parser)

read and parse a configuration file edn, clj, json, js, yaml, yml supported protocols supported are those of tools.io.core/file-reader

read and parse a configuration file
edn, clj, json, js, yaml, yml supported
protocols supported are those of `tools.io.core/file-reader`
sourceraw docstring

parentclj

(parent path)

Return the parent of a path.

Note it doesn't resolve symbolink links nor . nor ...

Return the parent of a path.

Note it doesn't resolve symbolink links nor `.` nor `..`.
sourceraw docstring

read-csv-fileclj

(read-csv-file in)
(read-csv-file in stream-args & csv-args)

return a lazy seq of parsed csv row as vector from a [protocol://]csv[.gz] file. see http://clojure.github.io/data.csv/ for options warning: the seq must be entirely consumed before the file is closed.

sample usage: (read-csv-file "infos_tarifs.csv" {:encoding "ISO-8859-1"} :separator ;)

return a lazy seq of parsed csv row as vector from a [protocol://]csv[.gz] file.
see http://clojure.github.io/data.csv/ for options
warning: the seq must be entirely consumed before the file is closed.

sample usage:
(read-csv-file "infos_tarifs.csv" {:encoding "ISO-8859-1"} :separator \;)
sourceraw docstring

read-edns-fileclj

return a lazy seq of parsed edn objects from a [protocol://]edn[.gz] file. warning: the seq must be entirely consumed before the file is closed.

return a lazy seq of parsed edn objects from a [protocol://]edn[.gz] file.
warning: the seq must be entirely consumed before the file is closed.
sourceraw docstring

read-edns-filesclj

return a lazy seq of parsed edn objects from [protocol://]edns[.gz] files. warning: the seq must be entirely consumed before every files are closed.

return a lazy seq of parsed edn objects from [protocol://]edns[.gz] files.
warning: the seq must be entirely consumed before every files are closed.
sourceraw docstring

read-jsons-fileclj

return a lazy seq of parsed json objects from a [protocol://]jsons[.gz] file. warning: the seq must be entirely consumed before the file is closed.

return a lazy seq of parsed json objects from a [protocol://]jsons[.gz] file.
warning: the seq must be entirely consumed before the file is closed.
sourceraw docstring

read-jsons-filesclj

return a lazy seq of parsed json objects from [protocol://]jsons[.gz] files. warning: the seq must be entirely consumed before every files are closed.

return a lazy seq of parsed json objects from [protocol://]jsons[.gz] files.
warning: the seq must be entirely consumed before every files are closed.
sourceraw docstring

read-string-files-fnclj

(read-string-files-fn read-file-fn)

Builder for a files-reader function. This is equivalent to read-string-format-file-fn but the returned function expects a sequence of filenames instead of just one.

Builder for a files-reader function. This is equivalent to
read-string-format-file-fn but the returned function expects a sequence of
filenames instead of just one.
sourceraw docstring

read-string-format-file-fnclj

(read-string-format-file-fn read-fn)

Builder for a file-reader function.

Builder for a file-reader function.
sourceraw docstring

read-text-fileclj

return a lazy seq of string from a [protocol://]text[.gz] file. warning: the seq must be entirely consumed before the file is closed.

return a lazy seq of string from a [protocol://]text[.gz] file.
warning: the seq must be entirely consumed before the file is closed.
sourceraw docstring

RmRfProtocolcljprotocol

rm-rfclj

(rm-rf path)

Recursively remove a directory

Recursively remove a directory
source

slurpclj

(slurp filename & opts)

Equivalent of clojure.core/slurp

Equivalent of clojure.core/slurp
sourceraw docstring

spitclj

(spit filename content & opts)

Equivalent of clojure.core/spit

Equivalent of clojure.core/spit
sourceraw docstring

splitextclj

(splitext path)

Split a file path in a pair of (file-path-without-extension, extension).

Split a file path in a pair of (file-path-without-extension, extension).
sourceraw docstring

strip-bomclj

(strip-bom s)

Remove the BOM on a string if necessary. See https://en.wikipedia.org/wiki/Byte_order_mark

Remove the BOM on a string if necessary.
See https://en.wikipedia.org/wiki/Byte_order_mark
sourceraw docstring

with-tempdircljmacro

(with-tempdir [x] & body)

Executes the body with a temporary directory whose name is bind to [x]:

(with-tempdir [dirname] (println "There's a directory called" dirname ".")) (println "The directory is now gone.")

Executes the body with a temporary directory whose name is bind to [x]:

(with-tempdir [dirname]
   (println "There's a directory called" dirname "."))
(println "The directory is now gone.")
sourceraw docstring

with-tempdir-implclj

(with-tempdir-impl f)
source

with-tempfilecljmacro

(with-tempfile [x] & body)

Executes the body with a temporary file whose name is bind to [x]:

(with-tempfile [filename] (println "There's a file called" filename ".")) (println "The file is now gone.")

Executes the body with a temporary file whose name is bind to [x]:

(with-tempfile [filename]
   (println "There's a file called" filename "."))
(println "The file is now gone.")
sourceraw docstring

with-tempfile-implclj

(with-tempfile-impl f)
source

write-csv-fileclj

(write-csv-file out stream-args & csv-args)

write a seq of vectors serialized as CSV in a [protocol://]csv[.gz] file. see http://clojure.github.io/data.csv/ for options.

(write-csv-file out my-lines) (write-csv-file out [stream-options-map] my-lines [csv options...])

Examples: (write-csv-file "animals.csv" [["name" "color"] ["cat" "black"] ["dog" "brown"]]) (write-csv-file "animals.csv" [["name" "color"] ["cat" "black"] ["dog" "brown"]] :separator ;)

(write-csv-file "people.csv" {:encoding "ISO-88591"} my-people) (write-csv-file "people.csv" {:encoding "ISO-88591"} my-people :separator ;)

write a seq of vectors serialized as CSV in a [protocol://]csv[.gz] file.
see http://clojure.github.io/data.csv/ for options.

(write-csv-file out my-lines)
(write-csv-file out [stream-options-map] my-lines [csv options...])

Examples:
 (write-csv-file "animals.csv" [["name" "color"] ["cat" "black"] ["dog" "brown"]])
 (write-csv-file "animals.csv" [["name" "color"] ["cat" "black"] ["dog" "brown"]] :separator \;)

 (write-csv-file "people.csv" {:encoding "ISO-88591"} my-people)
 (write-csv-file "people.csv" {:encoding "ISO-88591"} my-people :separator \;)
sourceraw docstring

write-edn-fileclj

(write-edn-file filename x)
(write-edn-file filename options x)

Write an element serialized as EDN in a [protocol://]edn[.gz] file. This is equivalent to call write-edns-file on a one-element sequence.

Write an element serialized as EDN in a [protocol://]edn[.gz] file.
This is equivalent to call write-edns-file on a one-element sequence.
sourceraw docstring

write-edns-fileclj

write a seq of elements serialized as EDN in a [protocol://]edn[.gz] file.

write a seq of elements serialized as EDN in a [protocol://]edn[.gz] file.
sourceraw docstring

write-jsons-fileclj

write a seq of elements serialized as JSON in a [protocol://]jsons[.gz] file.

write a seq of elements serialized as JSON in a [protocol://]jsons[.gz] file.
sourceraw docstring

write-string-file-fnclj

(write-string-file-fn serialize-fn)

Builder for a file-writer function. This is the opposite of read-string-format-file-fn.

Builder for a file-writer function. This is the opposite of
read-string-format-file-fn.
sourceraw docstring

write-text-fileclj

write a seq of strings in a [protocol://]text[.gz] file.

write a seq of strings in a [protocol://]text[.gz] file.
sourceraw docstring

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

× close