Skip to content
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

Added support for multiple paths as ZipStream sources #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
7 changes: 4 additions & 3 deletions zipstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,14 @@ def __init__(self, path, arc_path='', compression=ZIP_DEFLATED):

self.filelist = [] # List of ZipInfo instances for archive
self.compression = compression # Method of compression
self.path = path # source path
self.path = path if isinstance(path, list) else [path] # source path / list of paths
self.arc_path = arc_path # top level path in archive
self.data_ptr = 0 # Keep track of location inside archive

def __iter__(self):
for data in self.zip_path(self.path, self.arc_path):
yield data
for p in self.path
for data in self.zip_path(self.path, self.arc_path):
yield data

yield self.archive_footer()

Expand Down