Skip to content

Add ZipStream factory for reading zip entries#9

Merged
veewee merged 2 commits into
mainfrom
feat/zip-stream-factory
May 29, 2026
Merged

Add ZipStream factory for reading zip entries#9
veewee merged 2 commits into
mainfrom
feat/zip-stream-factory

Conversation

@veewee
Copy link
Copy Markdown
Contributor

@veewee veewee commented May 29, 2026

Summary

  • New ZipStream::read($archivePath, $entry, $zipOptions = []) factory for opening a single entry from a zip archive as a read-only ResourceStream.
  • Pre-checks archive existence (typed ResourceStreamException). All other failures (missing entry, corrupt archive, wrong/missing password) surface as StreamActionFailureException carrying the underlying PHP message — via the existing SafeStreamAction, no @ suppression.
  • Optional $zipOptions is passed straight under the zip key of stream_context_create(), so callers can supply e.g. ['password' => '...'] for encrypted entries.

The zip:// stream wrapper is read-only by design; write support would require ZipArchive and isn't part of this PR.

Test plan

  • Missing archive → ResourceStreamException
  • Happy path read
  • Nested entry read
  • Missing entry → StreamActionFailureException
  • Encrypted entry with correct password
  • Encrypted entry without password fails
  • Full suite green (51 tests)

@veewee veewee merged commit 88e94a4 into main May 29, 2026
25 checks passed
@veewee veewee deleted the feat/zip-stream-factory branch May 29, 2026 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant