framed.std.io

I/O utility functions to complement clojure.java.io

->Path

(->Path x)
Construct a java.nio.file.Path from file-like x

copy

(copy src dest)
Copy file-like src to file-like dest and return dest. Asserts dest is
not a non-empty file (see `clojure.java.io/copy` for unchecked copies)

Note: May theoretically race between dest-checking and copying

data-input-stream

(data-input-stream istream-like)
Coerce argument to an open java.io.DataInputStream

data-output-stream

(data-output-stream ostream-like)
Coerce argument to an open java.io.DataOutputStream

move

(move src dest)
Atomically move file-like src to file-like dest and return dest.
Throws error if dest already exists

move'

(move' src dest)
Atomically move file-like src to file-like dest and return dest.

nonempty-file?

(nonempty-file? x)
Does file-like x exist and contain more than zero bytes?

path-get

(path-get part & parts)
Wrapper for java.nio.file.PathslPaths.get - converts a String
or seq of Strings to a Path using the system file separator

path-join

(path-join part & parts)
Join Strings into a String path using the system file separator

spit

(spit f content & options)
Like clojure.core/spit, but returns f

stream-copy

(stream-copy input-stream output-stream)
Copy from input stream to output stream.
Does *not* close streams

temp-path

(temp-path)
Generate a random filename in the system temp directory
Does *not* create a file, only generates a path

tempfile

(tempfile)(tempfile filename)(tempfile filename suffix)
Create a tempfile that deletes on VM exit

tmpdir

The system temporary directory