Skip to content

Example code seems wrong #377

Closed
Closed
@Frydac

Description

@Frydac

I created some functionality to zip a folder recursively based on the example code here, however, the files before zipping where not binary equal to the unzipped files.

When I changed the following line:

    else
        io.get_output_stream(zipFilePath) { |f| f.puts(File.open(diskFilePath, "rb").read())}
    end

to

    else
        io.get_output_stream(zipFilePath) { |f| f.write(File.open(diskFilePath, "rb").read())}
    end

Files are binary equal after zipping/unzipping

EDIT: I still had a mistake.. imho which shows the example code should be tested thoroughly on multiple platforms.

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