zipstream-ng
zipstream-ng copied to clipboard
Set the timestamp for each file when adding data from a stream
Thank you for a very nice package.
I am missing the ability to set the last modified timestamp for each file when adding them from a stream.
I tried this, but the zs.add() does not take a date_time parameter:
zs.add(
data=file_data,
arcname=file_name,
date_time=file.updated_at.timetuple()
if file.updated_at and file.updated_at.year >= 1980
else datetime.now().timetuple(),
)
Maybe it's possible to do it in another way, but I did not find it.
Yes, currently the only way to add a datetime is for you to add a file and have it automatically pull the datetime from the file metadata itself.
I've been working on a bit of a refactor of how data is queued up for streaming that would enable this on the refactor/queue branch but it's not done yet.