archive ^
puts files into an archive
(archive "dev/scratch/hello.jar" "src")
=> coll?
create ^
creats a zip file
(fs/delete "dev/scratch/hello.jar")
(create "dev/scratch/hello.jar")
=> zip-system?
extract ^
extracts all file from an archive
(defn extract
([archive]
(extract archive (fs/parent (url archive))))
([archive output]
(extract archive output (list archive)))
([archive output entries]
(protocol.archive/-extract (open archive {:create false}) output entries)))
(extract "dev/scratch/hello.jar")
=> coll?
has? ^
checks if the archive has a particular entry
(has? "dev/scratch/hello.jar" "world.java")
=> false
insert ^
inserts a file to an entry within the archive
(insert "dev/scratch/hello.jar" "project.clj" "project.clj")
=> fs/path?
list ^
lists all the entries in the archive
(map str (list "dev/scratch/hello.jar"))
=> ["/"]
open ^
either opens an existing archive or creates one if it doesn't exist
(open "dev/scratch/hello.jar" {:create true})
=> zip-system?
path ^
returns the url of the archive
(-> (open "dev/scratch/hello.jar")
(path "world.java")
(str))
=> "world.java"
remove ^
removes an entry from the archive
(remove "dev/scratch/hello.jar" "project.clj")
=> #{"project.clj"}
stream ^
creates a stream for an entry wthin the archive
(do (insert "dev/scratch/hello.jar" "project.clj" "project.clj")
(slurp (stream "dev/scratch/hello.jar" "project.clj")))
=> (slurp "project.clj")
url ^
returns the url of the archive
(url (open "dev/scratch/hello.jar"))
=> (str (fs/path "dev/scratch/hello.jar"))
write ^
writes files to an archive
(doto "dev/scratch/hello.jar"
(fs/delete)
(open)
(write "test.stuff"
(binary/input-stream (.getBytes "Hello World"))))
(slurp (stream (open "dev/scratch/hello.jar") "test.stuff"))
=> "Hello World"
zip-system? ^
checks if object is a `ZipSystem`
(zip-system? (open "dev/scratch/hello.jar"))
=> true