Kouhei Sutou 2019-03-01 18:10:04 +0900 (Fri, 01 Mar 2019) Revision: c93ed70963062e8cff70c5bc804bc536436b1f7b https://github.com/ranguba/chupa-text/commit/c93ed70963062e8cff70c5bc804bc536436b1f7b Message: zip: reduce memory usage Modified files: lib/chupa-text/decomposers/zip.rb Modified: lib/chupa-text/decomposers/zip.rb (+4 -4) =================================================================== --- lib/chupa-text/decomposers/zip.rb 2019-03-01 17:44:55 +0900 (203c3f1) +++ lib/chupa-text/decomposers/zip.rb 2019-03-01 18:10:04 +0900 (01647a4) @@ -14,8 +14,6 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -require "stringio" - require "archive/zip" require "chupa-text/path-converter" @@ -63,8 +61,10 @@ module ChupaText private def open_zip(data) begin - Archive::Zip.open(StringIO.new(data.body)) do |zip| - yield(zip) + data.open do |input| + Archive::Zip.open(input) do |zip| + yield(zip) + end end rescue Archive::Zip::Error => zip_error error do -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20190301/fd03298b/attachment.html>