Planck I/O functionality.
Planck I/O functionality.
(as-relative-path x)
Take an as-file-able thing and return a string if it is a relative path, else throws an exception.
Take an as-file-able thing and return a string if it is a relative path, else throws an exception.
Coerce between various 'resource-namish' things.
Coerce between various 'resource-namish' things.
(as-file x)
Coerce argument to a File
.
Coerce argument to a [[File]].
(as-url x)
Coerce argument to a goog.Uri
.
Coerce argument to a `goog.Uri`.
(copy input output & opts)
Copies input to output. Returns nil
or throws an exception.
Input may be an planck.core/IInputStream
or planck.core/IReader
created using planck.io
, File
, or string.
Output may be an planck.core/IOutputStream
or [[cljs.core/IWriter]]
created using planck.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).
Copies input to output. Returns `nil` or throws an exception. Input may be an [[planck.core/IInputStream]] or [[planck.core/IReader]] created using `planck.io`, [[File]], or string. Output may be an [[planck.core/IOutputStream]] or [[cljs.core/IWriter]] created using `planck.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).
(directory? dir)
Checks if dir
is a directory.
Checks if `dir` is a directory.
(file arg)
(file parent child)
(file 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.
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.
(file-attributes path)
Returns a map containing the attributes of the item at a given path.
Returns a map containing the attributes of the item at a given path.
(file-name x)
Returns the name (the final path element) of x
.
Returns the name (the final path element) of `x`.
(hidden-file? x)
Checks if x
is hidden (name starts with a .
character).
Checks if `x` is hidden (name starts with a `.` character).
(input-stream x & opts)
Attempts to coerce its argument into an open planck.core/IInputStream
.
Attempts to coerce its argument into an open [[planck.core/IInputStream]].
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
.
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-output-stream x opts)
Creates an planck.core/IOutputStream
. See also IOFactory
docs.
Creates an [[planck.core/IOutputStream]]. See also [[IOFactory]] docs.
(make-writer x opts)
Creates an [[cljs.core/IWriter]]. See also IOFactory
docs.
Creates an [[cljs.core/IWriter]]. See also [[IOFactory]] docs.
(make-reader x opts)
Creates an planck.core/IReader
. See also IOFactory
docs.
Creates an [[planck.core/IReader]]. See also [[IOFactory]] docs.
(make-input-stream x opts)
Creates an planck.core/IInputStream
. See also IOFactory
docs.
Creates an [[planck.core/IInputStream]]. See also [[IOFactory]] docs.
(list-files dir)
Returns a seq of the File
s in dir or nil
if dir is not a directory.
Returns a seq of the [[File]]s in dir or `nil` if dir is not a directory.
(make-parents f & more)
Given the same arg(s) as for file
, creates all parent directories of
the file they represent.
Given the same arg(s) as for [[file]], creates all parent directories of the file they represent.
(output-stream x & opts)
Attempts to coerce its argument into an open planck.core/IOutputStream
.
Attempts to coerce its argument into an open [[planck.core/IOutputStream]].
(path-elements x)
Returns the path elements of x
as a sequence.
Returns the path elements of `x` as a sequence.
(reader x & opts)
Attempts to coerce its argument into an open planck.core/IPushbackReader
.
Attempts to coerce its argument into an open [[planck.core/IPushbackReader]].
(regular-file? f)
Checks if f
is a regular file.
Checks if `f` is a regular file.
(resource n)
Returns the URI for the named resource, n
.
The resource must be either a JAR resource, a file resource or a "bundled"
resource. JARs and files are expressed relative to the classpath while
"bundled" resources are the namespaces bundled with Planck and are referred
to by reference to the file that contains the namespace, eg. cljs.test
is
"cljs/test.cljs".
Returns the URI for the named resource, `n`. The resource must be either a JAR resource, a file resource or a "bundled" resource. JARs and files are expressed relative to the classpath while "bundled" resources are the namespaces bundled with Planck and are referred to by reference to the file that contains the namespace, eg. `cljs.test` is "cljs/test.cljs".
(symbolic-link? f)
Checks if f
is a symbolic link.
Checks if `f` is a symbolic link.
(tty? x)
Returns true
if x
is a file descriptor associated with a terminal,
or x is either a Reader/Writer among *in*
, *out*
, or *err*
which is
associated with a terminal.
Returns false if x
is a file descriptor, *in*
, *out*
, or *err*
and
not associated with a terminal, or an invalid file descriptor.
Returns `true` if `x `is a file descriptor associated with a terminal, or x is either a Reader/Writer among `*in*`, `*out*`, or `*err*` which is associated with a terminal. Returns false if `x` is a file descriptor, `*in*`, `*out*`, or `*err*` and not associated with a terminal, or an invalid file descriptor.
(writer x & opts)
Attempts to coerce its argument into an open [[cljs.core/IWriter]].
Attempts to coerce its argument into an open [[cljs.core/IWriter]].
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close