From 25199ab4c29057d7c0a73812fc8f2ac3605c1d86 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Wed, 10 Aug 2016 21:04:41 -0400 Subject: add documentation --- index.html | 160 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 index.html (limited to 'index.html') diff --git a/index.html b/index.html new file mode 100644 index 0000000..0314d29 --- /dev/null +++ b/index.html @@ -0,0 +1,160 @@ + + + + + + + + README - github.com/pablotron/zip-crystal + + + +
+ + + + + + +
+ +
+

zip-crystal

+ +

Read and write zip archives natively from +Crystal.

+ +

Installation

+ +

Add this to your application's shard.yml:

+ +
dependencies:
+  zip-crystal:
+    github: pablotron/zip-crystal
+ +

Usage

+ +
require "zip-crystal/zip"
+
+# write to "foo.zip"
+Zip.write("foo.zip") do |zip|
+  # add "bar.txt" with contents "hello!"
+  zip.add("bar.txt", "hello!")
+
+  # add local file "/path/to/image.png" as "image.png"
+  zip.add_file("image.png", "/path/to/image.png")
+end
+
+# create memory io
+mem_io = MemoryIO.new
+
+# open "/some/other/path/image.png" for writing
+File.open("/some/other/path/image.png", "wb") do |file_io|
+  # read from "foo.zip"
+  Zip.read("foo.zip") do |zip|
+    # extract "bar.txt" to mem_io
+    zip["bar.txt"].read(mem_io)
+
+    # extract "image.png" to file_io
+    zip["image.png"].read(file_io)
+  end
+end
+ +

See the API documentation +for additional information.

+ +

Development

+ +

TODO: Write development instructions here

+ +

Contributing

+ +
  1. Fork it ( https://github.com/pablotron/zip-crystal/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request
+ +

Contributors

+ + +
+ + -- cgit v1.2.3