README.md in zip_tricks-5.3.1 vs README.md in zip_tricks-5.4.0
- old
+ new
@@ -22,15 +22,15 @@
to [32 bit sizes.](https://github.com/jruby/jruby/issues/3817)
## Diving in: send some large CSV reports from Rails
-The easiest is to use the Rails' built-in streaming feature:
+The easiest is to include the `ZipTricks::RailsStreaming` module into your
+controller.
```ruby
class ZipsController < ActionController::Base
- include ActionController::Live # required for streaming
include ZipTricks::RailsStreaming
def download
zip_tricks_stream do |zip|
zip.write_deflated_file('report1.csv') do |sink|
@@ -47,10 +47,14 @@
end
end
end
```
+If you want some more conveniences you can also use [zipline](https://github.com/fringd/zipline) which
+will automatically process and stream attachments (Carrierwave, Shrine, ActiveStorage) and remote objects
+via HTTP.
+
## Create a ZIP file without size estimation, compress on-the-fly during writes
Basic use case is compressing on the fly. Some data will be buffered by the Zlib deflater, but
memory inflation is going to be very constrained. Data will be written to destination at fairly regular
intervals. Deflate compression will work best for things like text files.
@@ -82,11 +86,11 @@
end
zip.write_deflated_file('long-novel.txt') do |sink|
File.open('novel.txt', 'rb'){|source| IO.copy_stream(source, sink) }
end
end
-[200, {'Transfer-Encoding' => 'chunked'}, body]
+[200, {}, body]
```
## Send a ZIP file of known size, with correct headers
Use the `SizeEstimator` to compute the correct size of the resulting archive.
@@ -172,11 +176,14 @@
* Fork the project.
* Start a feature/bugfix branch.
* Commit and push until you are happy with your contribution.
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
-* If you alter the `ZipWriter`, please take the time to run the test in the `qa/` directory. Ensure that the generated (large) files open manually - see README_QA for more.
-## Copyright
+## Copyright and license
-Copyright (c) 2019 WeTransfer. `zip_tricks` is distributed under the conditions of the [Hippocratic License](https://firstdonoharm.dev/version/1/2/license.html)
- - See LICENSE.txt for further details.
+Copyright (c) 2020 WeTransfer.
+
+`zip_tricks` is distributed under the conditions of the [Hippocratic License](https://firstdonoharm.dev/version/1/2/license.html)
+See LICENSE.txt for further details. If this license is not acceptable for your use case we still maintain the 4.x version tree
+which remains under the MIT license, see https://rubygems.org/gems/zip_tricks/versions for more information.
+Note that we only backport some performance optimizations and crucial bugfixes but not the new features to that tree.