Liking cljdoc? Tell your friends :D

tools.io.core


close!clj

(close! {:keys [stream close-fn] :as file})

Close a stream and optionally call its close-fn function if it's present.

Close a stream and optionally call its close-fn function if it's present.
sourceraw docstring

copyclj

(copy input output opts)
source

delete-filecljmultimethod

Deletes a file with any implementation.

Deletes a file with any implementation.
sourceraw docstring

exists?cljmultimethod

Returns true if filename exists.

Returns `true` if filename exists.
sourceraw docstring

file-readerclj

(file-reader filename)
(file-reader filename options)

Returns a file reader.

Returns a file reader.
sourceraw docstring

file-writerclj

(file-writer filename)
(file-writer filename options)

Returns a file writer.

Returns a file writer.
sourceraw docstring

get-file-typeclj

(get-file-type filename)
(get-file-type filename _ & _)

Dispatch function for files IO multimethods.

Dispatch function for files IO multimethods.
sourceraw docstring

input-streamclj

(input-stream filename)
(input-stream filename options)

Returns an input-stream for plain or compressed file.

Returns an input-stream for plain or compressed file.
sourceraw docstring

list-dirscljmultimethod

Returns a seq of directories with provided path as prefix.

Returns a seq of directories with provided path as prefix.
sourceraw docstring

list-filescljmultimethod

Returns a seq of filenames with provided path as prefix.

Returns a seq of filenames with provided path as prefix.
sourceraw docstring

mk-input-streamcljmultimethod

Returns an input stream with any implementation.

Returns an input stream with any implementation.
sourceraw docstring

mk-output-streamcljmultimethod

Returns an output stream with any implementation.

Returns an output stream with any implementation.
sourceraw docstring

output-streamclj

(output-stream filename)
(output-stream filename options)

Returns an output-stream for plain or compressed file.

Returns an output-stream for plain or compressed file.
sourceraw docstring

register-file-pred!clj

(register-file-pred! file-type file-pred)

Registers a new file type with a file predicate.

Extends the dispatch function of the multimethods with your own implementation.

Example: (register-file-pred! :my-filetype (fn [filename] (clojure.string/starts-with? (str filename) "myprotocol://")))

(defmethod mk-input-stream :my-filetype [filename & [options]] ;; ... {:stream ...})

The code above is sufficient to get all reading function for free on your custom protocol, given that mk-input-stream works correctly.

Registers a new file type with a file predicate.

Extends the dispatch function of the multimethods with your own
implementation.

Example:
  (register-file-pred!
    :my-filetype
    (fn [filename]
     (clojure.string/starts-with? (str filename) "myprotocol://")))

  (defmethod mk-input-stream :my-filetype
    [filename & [options]]
    ;; ...
    {:stream ...})

The code above is sufficient to get all reading function for free on your
custom protocol, given that mk-input-stream works correctly.
sourceraw docstring

sizeofcljmultimethod

Probe the size of the target files/folder. Should not load dataset in memory.

Probe the size of the target files/folder.
Should not load dataset in memory.
sourceraw docstring

unregister-file-pred!clj

(unregister-file-pred! file-type)
source

unzip-filecljmultimethod

Unzip the targeted file to the current directory. If not a Zip file, yield nil.

Unzip the targeted file to the current directory.
If not a Zip file, yield `nil`.
sourceraw docstring

zip-directorycljmultimethod

Creates zip from target directory.

Creates zip from target directory.
sourceraw docstring

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

× close