(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
(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"
(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.
(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
(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"
(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 responsability 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 responsability to close the file using tools.io.core/close! when it’s done.
(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
(list-files path & [options])
Alias of tools.io.core/list-files for backward compatibility.
Alias of tools.io.core/list-files for backward compatibility.
(load-config-file filename)
(load-config-file filename parser)
read and parse a configuration file edn, clj, json, js, yaml, yml supported
read and parse a configuration file edn, clj, json, js, yaml, yml supported
(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 `..`.
(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 \;)
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.
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.
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.
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.
(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.
(read-string-format-file-fn read-fn)
Builder for a file-reader function.
Builder for a file-reader function.
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.
(rm-rf path)
Recursively remove a directory
Recursively remove a directory
(slurp filename & opts)
Equivalent of clojure.core/slurp
Equivalent of clojure.core/slurp
(spit filename content & opts)
Equivalent of clojure.core/spit
Equivalent of clojure.core/spit
(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).
(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
(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.")
(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.")
(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 \;)
(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.
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.
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.
(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.
write a seq of strings in a [protocol://]text[.gz] file.
write a seq of strings in a [protocol://]text[.gz] file.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close