Skip to content

IO class is not properly supported for streaming. #192

@weshatheleopard

Description

@weshatheleopard

Change the code at the following location (

Zip::File.open_buffer(File.binread(zname)) do |zipfile|
) to be as follows:

File.open(zname, 'rb') { |f|
  Zip::File.open_buffer(f) do |zipfile|
  end
}

According to the documentation, IO object is valid in this situation. However, the modified test fails:

ZipFileTest#test_streaming:
ArgumentError: wrong number of arguments (0 for 1..2)
    /mnt/var/git/rubyzip/lib/zip/output_stream.rb:32:in `reopen'
    /mnt/var/git/rubyzip/lib/zip/output_stream.rb:32:in `initialize'
    /mnt/var/git/rubyzip/lib/zip/output_stream.rb:59:in `new'
    /mnt/var/git/rubyzip/lib/zip/output_stream.rb:59:in `write_buffer'
    /mnt/var/git/rubyzip/lib/zip/file.rb:317:in `write_buffer'
    /mnt/var/git/rubyzip/lib/zip/file.rb:128:in `open_buffer'
    /mnt/var/git/rubyzip/test/file_test.rb:542:in `block in test_streaming'
    /mnt/var/git/rubyzip/test/file_test.rb:541:in `open'
    /mnt/var/git/rubyzip/test/file_test.rb:541:in `test_streaming'

Also see related #177.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions