8000 example_recursive.rb lost some special characters (0x1a at file end) … by EagleSHCN · Pull Request #297 · rubyzip/rubyzip · GitHub
[go: up one dir, main page]

Skip to content

example_recursive.rb lost some special characters (0x1a at file end) … #297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 9, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
example_recursive.rb lost some special characters (0x1a at file end) …
…in file

example_recursive.rb lost some special characters ( for example 0x1a at file end ) , it should related to io stream implementation . Use internal zip add method instead of File.read could avoid this lose . 

An issue is posted at #296
  • Loading branch information
EagleSHCN authored Aug 15, 2016
commit b0b54e505fb48858dfeab3a074db7872d56af15c
4 changes: 1 addition & 3 deletions samples/example_recursive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ def recursively_deflate_directory(disk_file_path, io, zip_file_path)
end

def put_into_archive(disk_file_path, io, zip_file_path)
io.get_output_stream(zip_file_path) do |f|
f.write(File.open(disk_file_path, 'rb').read)
end
io.add(zip_file_path, disk_file_path)
end
end
0