diff options
author | Paul Duncan <pabs@pablotron.org> | 2016-08-10 21:04:41 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2016-08-10 21:04:41 -0400 |
commit | 25199ab4c29057d7c0a73812fc8f2ac3605c1d86 (patch) | |
tree | 78f93a21b23da48b8cd0113e8262876426cfa7e6 /index.html | |
parent | 533ee3ceb098919da478a6be57a2f4342712aca5 (diff) | |
download | zip-crystal-25199ab4c29057d7c0a73812fc8f2ac3605c1d86.tar.bz2 zip-crystal-25199ab4c29057d7c0a73812fc8f2ac3605c1d86.zip |
add documentation
Diffstat (limited to 'index.html')
-rw-r--r-- | index.html | 160 |
1 files changed, 160 insertions, 0 deletions
diff --git a/index.html b/index.html new file mode 100644 index 0000000..0314d29 --- /dev/null +++ b/index.html @@ -0,0 +1,160 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8" /> + <meta id="repository-name" content="github.com/pablotron/zip-crystal"> + <link href="css/style.css" rel="stylesheet" type="text/css" /> + <script type="text/javascript" src="js/doc.js"></script> + <title>README - github.com/pablotron/zip-crystal</title> +</head> +<body> + +<div id="types-list"> + <div id="search-box"> + <input type="search" id="search-input" placeholder="Search..."> + </div> + + <ul> + <li class="current"><a href="index.html">README</a></li> + </ul> + + <ul> + + <li class="parent " data-id="github.com/pablotron/zip-crystal/Zip" data-name="zip"> + <a href="Zip.html">Zip</a> + + <ul> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Archive" data-name="zip::archive"> + <a href="Zip/Archive.html">Archive</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/CompressionMethod" data-name="zip::compressionmethod"> + <a href="Zip/CompressionMethod.html">CompressionMethod</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/DeflateCompressionHelper" data-name="zip::deflatecompressionhelper"> + <a href="Zip/DeflateCompressionHelper.html">DeflateCompressionHelper</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Entry" data-name="zip::entry"> + <a href="Zip/Entry.html">Entry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Error" data-name="zip::error"> + <a href="Zip/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Extra" data-name="zip::extra"> + <a href="Zip/Extra.html">Extra</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/GeneralFlags" data-name="zip::generalflags"> + <a href="Zip/GeneralFlags.html">GeneralFlags</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/NoneCompressionHelper" data-name="zip::nonecompressionhelper"> + <a href="Zip/NoneCompressionHelper.html">NoneCompressionHelper</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Source" data-name="zip::source"> + <a href="Zip/Source.html">Source</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/TimeHelper" data-name="zip::timehelper"> + <a href="Zip/TimeHelper.html">TimeHelper</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Version" data-name="zip::version"> + <a href="Zip/Version.html">Version</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writer" data-name="zip::writer"> + <a href="Zip/Writer.html">Writer</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/WriterEntry" data-name="zip::writerentry"> + <a href="Zip/WriterEntry.html">WriterEntry</a> + + </li> + +</ul> + + + </li> + +</ul> + +</div> + +<div id="main-content"> +<h1>zip-crystal</h1> + +<p>Read and write zip archives natively from +<a href="http://crystal-lang.org/" target="_blank">Crystal</a>.</p> + +<h2>Installation</h2> + +<p>Add this to your application's <code>shard.yml</code>:</p> + +<pre><code class='language-yaml'>dependencies: + zip-crystal: + github: pablotron/zip-crystal</code></pre> + +<h2>Usage</h2> + +<pre><code class='language-crystal'><span class="k">require</span> <span class="s">"zip-crystal/zip"</span> + +<span class="c"># write to "foo.zip"</span> +<span class="t">Zip</span>.write(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + <span class="c"># add "bar.txt" with contents "hello!"</span> + zip.add(<span class="s">"bar.txt"</span>, <span class="s">"hello!"</span>) + + <span class="c"># add local file "/path/to/image.png" as "image.png"</span> + zip.add_file(<span class="s">"image.png"</span>, <span class="s">"/path/to/image.png"</span>) +<span class="k">end</span> + +<span class="c"># create memory io</span> +mem_io <span class="o">=</span> <span class="t">MemoryIO</span>.<span class="k">new</span> + +<span class="c"># open "/some/other/path/image.png" for writing</span> +<span class="t">File</span>.open(<span class="s">"/some/other/path/image.png"</span>, <span class="s">"wb"</span>) <span class="k">do</span> <span class="o">|</span>file_io<span class="o">|</span> + <span class="c"># read from "foo.zip"</span> + <span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + <span class="c"># extract "bar.txt" to mem_io</span> + zip[<span class="s">"bar.txt"</span>].read(mem_io) + + <span class="c"># extract "image.png" to file_io</span> + zip[<span class="s">"image.png"</span>].read(file_io) + <span class="k">end</span> +<span class="k">end</span></code></pre> + +<p>See the <a href="https://pablotron.github.com/zip-crystal/" target="_blank">API documentation</a> +for additional information.</p> + +<h2>Development</h2> + +<p>TODO: Write development instructions here</p> + +<h2>Contributing</h2> + +<ol><li>Fork it ( https://github.com/pablotron/zip-crystal/fork )</li><li>Create your feature branch (git checkout -b my-new-feature)</li><li>Commit your changes (git commit -am 'Add some feature')</li><li>Push to the branch (git push origin my-new-feature)</li><li>Create a new Pull Request</li></ol> + +<h2>Contributors</h2> + +<ul><li><a href="https://github.com/pablotron" target="_blank">pablotron</a> Paul Duncan - creator, maintainer</li></ul> +</div> +</body> +</html> |