diff options
author | Paul Duncan <pabs@pablotron.org> | 2016-08-10 21:03:01 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2016-08-10 21:03:01 -0400 |
commit | 533ee3ceb098919da478a6be57a2f4342712aca5 (patch) | |
tree | 8c68d38bfe6c628c6568d184e4b12fdc194ce20d | |
parent | 3e43d9c16ed601e6f3209bd310f5a6c4018ca19c (diff) | |
download | zip-crystal-533ee3ceb098919da478a6be57a2f4342712aca5.tar.bz2 zip-crystal-533ee3ceb098919da478a6be57a2f4342712aca5.zip |
update README
-rw-r--r-- | README.md | 39 |
1 files changed, 32 insertions, 7 deletions
@@ -1,6 +1,7 @@ # zip-crystal -TODO: Write a description here +Read and write zip archives natively from +[Crystal](http://crystal-lang.org/). ## Installation @@ -10,7 +11,7 @@ Add this to your application's `shard.yml`: ```yaml dependencies: zip-crystal: - github: [your-github-name]/zip-crystal + github: pablotron/zip-crystal ``` @@ -18,11 +19,35 @@ dependencies: ```crystal -require "zip-crystal" +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 ``` - -TODO: Write usage instructions here +See the [API documentation](https://pablotron.github.com/zip-crystal/) +for additional information. ## Development @@ -30,7 +55,7 @@ TODO: Write development instructions here ## Contributing -1. Fork it ( https://github.com/[your-github-name]/zip-crystal/fork ) +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) @@ -38,4 +63,4 @@ TODO: Write development instructions here ## Contributors -- [[your-github-name]](https://github.com/[your-github-name]) Paul Duncan - creator, maintainer +- [pablotron](https://github.com/pablotron) Paul Duncan - creator, maintainer |