Replete I/O functionality.
Note that Replete access a private filesystem on your device.
Protocols
Types
Vars
as-file
as-relative-path
as-url
copy
delete-file
directory?
file
file?
file-attributes
input-stream
list-files
make-input-stream
make-output-stream
make-parents
make-reader
make-writer
output-stream
reader
resource
writer
Coerce between various 'resource-namish' things.
as-file
([x])
Coerce argument to a File
.
as-url
([x])
Coerce argument to a goog.Uri
.
Factory functions that create ready-to-use versions of the various stream types, on top of anything that can be unequivocally converted to the requested kind of stream.
Common options include
:append
true to open stream in append mode
:encoding
string name of encoding to use, e.g. "UTF-8".
Callers should generally prefer the higher level API provided by reader
, writer
, input-stream
, and output-stream
.
make-reader
([x opts])
Creates an IReader
. See also IOFactory
docs.
make-writer
([x opts])
Creates an IWriter
. See also IOFactory
docs.
make-input-stream
([x opts])
Creates an IInputStream
. See also IOFactory
docs.
make-output-stream
([x opts])
Creates an IOutputStream
. See also IOFactory
docs.
Type
Fields: [path]
Represents a file.
([x])
Coerce argument to a File
.
([x])
Take an as-file
-able thing and return a string if it is a relative path, else throws an exception.
([x])
Coerce argument to a goog.Uri
.
([input output & opts])
Copies input to output. Returns nil or throws an exception.
Input may be an IInputStream
or IReader
created using replete.io
, File
, or string.
Output may be an IOutputStram
or IWriter
created using replete.io
, or File
.
The opts
arg is included for compatibility with clojure.java.io/copy
but ignored. If translating between char and byte representations, UTF-8 encoding is assumed.
Does not close any streams except those it opens itself (on a File
).
Spec
args: (cat :input any? :output any? :opts (* any?))
ret: nil?
([f])
Delete file f
.
Spec
args: (cat :f (or :string string? :file file?))
([dir])
Checks if dir
is a directory.
Spec
args: (cat :dir (or :string string? :file file?))
ret: boolean?
([arg] [parent child] [parent child & more])
Returns a File
, passing each arg to as-file
. Multiple-arg versions treat the first argument as parent and subsequent args as children relative to the parent.
Spec
args: (cat :path-or-parent any? :more (* any?))
ret: file?
([x])
Returns true
if x
is a File
.
Spec
args: (s/cat :x any?)
ret: boolean?
([path])
Returns a map containing the attributes of the item at a given path
.
Spec args: (cat :path (nillable? (or :string string? :file file?)))
ret: map?
([x & opts])
Attempts to coerce its argument into an open IInputStream
.
([dir])
Returns a seq of the File
s in dir
or nil
if dir
is not a directory.
Spec args: (cat :dir (or :string string? :file file?))
ret: (coll-of file?)
([x opts])
Creates an IInputStream
. See also IOFactory
docs.
([x opts])
IOutputStream
. See also IOFactory
docs.([f & more])
Given the same arg(s) as for file
, creates all parent directories of the file they represent.
Spec
args: (cat :path-or-parent any? :more (* any?))
ret: boolean?
([x opts])
Creates an IReader
. See also IOFactory
docs.
([x opts])
Creates an IWriter
. See also IOFactory
docs.
([x & opts])
Attempts to coerce its argument into an open IOutputStream
.
([x & opts])
Attempts to coerce its argument into an open IPushbackReader
.
([n])
Returns the URI for the named resource, n
.
Spec
args: (cat :n (nilable string?))
ret: (nilable (instance? Uri %))
([x & opts])
Attempts to coerce its argument into an open IWriter
.