Skip to content

Conversation

@cmaglie
Copy link
Collaborator

@cmaglie cmaglie commented May 25, 2023

The .zip extractor requires an io.ReaderAt and the size of the archive:

  1. we could inspect the given io.Reader to see if it implements the interface io.ReaderAt
  2. to obtain the size we can use the Seek method, usually if the reader is a ReaderAt it's very liketly to implement also io.Seeker

If the two conditions above are satisfied we can avoid buffering the entire archive in memory.

This PR also remove the dependency on the deprecated io/util package.

@cmaglie cmaglie requested a review from umbynos May 25, 2023 14:07
@cmaglie cmaglie self-assigned this May 25, 2023
@umbynos umbynos merged commit 07d6c33 into master May 26, 2023
@cmaglie cmaglie deleted the improve_memory_usage branch May 26, 2023 13:38
Copy link
Collaborator

@umbynos umbynos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

cmaglie added a commit to cmaglie/arduino-cli that referenced this pull request May 26, 2023
This is obtained through the upgrade of the 'extract' library.

Upstream patch: codeclysm/extract#21
cmaglie added a commit to arduino/arduino-cli that referenced this pull request May 26, 2023
This is obtained through the upgrade of the 'extract' library.

Upstream patch: codeclysm/extract#21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants