Skip to main content

File Operations

36
  • as-file

    Coerce argument to a file.

  • as-relative-path

    Take an as-file-able thing and return a string if it is a relative path, else IllegalArgumentException.

  • as-url

    Coerce argument to a URL.

  • copy

    Copies input to output. Returns nil or throws IOException. Input may be an InputStream, Reader, File, byte[], char[],...

  • delete-file

    Delete file f. If silently is nil or false, raise an exception on failure, else return the value of silently.

  • exec

    Execute a command and on successful exit, return the captured output, else throw RuntimeException. Args are the same a...

  • exit-ref

    Given a Process (the output of 'start'), return a reference that can be used to wait for process completion then retur...

  • file

    Returns a java.io.File, passing each arg to as-file. Multiple-arg versions treat the first argument as parent and su...

  • file-seq

    A tree seq on java.io.Files

  • from-file

    Coerce f to a file per clojure.java.io/file and return a ProcessBuilder.Redirect reading from the file. This can be pa...

  • input-stream

    Attempts to coerce its argument into an open java.io.InputStream. Default implementations always return a java.io.Buf...

  • line-seq

    Returns the lines of text from rdr as a lazy sequence of strings. rdr must implement java.io.BufferedReader.

  • make-parents

    Given the same arg(s) as for file, creates all parent directories of the file they represent.

  • output-stream

    Attempts to coerce its argument into an open java.io.OutputStream. Default implementations always return a java.io.Bu...

  • read-line

    Reads the next line from stream that is the current value of *in* .

  • reader

    Attempts to coerce its argument into an open java.io.Reader. Default implementations always return a java.io.Buffered...

  • reader

    Creates a reader over the provided source `in` using the specified format, one of: :msgpack, :json or :json-verbose. ...

  • reader

    Coerces x into indexing pushback-reader to be used with parse-next. Accepts string or `java.io.Reader`

  • reader

    Coerces x into indexing pushback-reader to be used with parse-next. Accepts: string or java.io.Reader.

  • sh

    Passes the given strings to Runtime.exec() to launch a sub-process. Options are :in may be given followed by ...

  • slurp

    Opens a reader on f and reads all its contents, returning a string. See clojure.java.io/reader for a complete list of ...

  • spit

    Opposite of slurp. Opens f with writer, writes content, then closes f. Options passed to clojure.java.io/writer.

  • start

    Start an external command, defined in args. The process environment vars are inherited from the parent by default (u...

  • stderr

    Given a process, return the stderr of the external process (an InputStream)

  • stdin

    Given a process, return the stdin of the external process (an OutputStream)

  • stdout

    Given a process, return the stdout of the external process (an InputStream)

  • to-file

    Coerce f to a file per clojure.java.io/file and return a ProcessBuilder.Redirect writing to the file. Set ':append' in...

  • with-open

    bindings => [name init ...] Evaluates body in a try expression with names bound to the values of the inits, and a f...

  • with-sh-dir

    Sets the directory for use with sh, see sh for details.

  • with-sh-env

    Sets the environment for use with sh, see sh for details.

  • writer

    Attempts to coerce its argument into an open java.io.Writer. Default implementations always return a java.io.Buffered...

  • writer

    Creates a writer over the provided destination `out` using the specified format, one of: :msgpack, :json or :json-ver...