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

#102 #103 Allow users to override write functionality more easily #104

Closed
wants to merge 3 commits into from

Conversation

yash-fn
Copy link

@yash-fn yash-fn commented Feb 7, 2022

Referring to #102 and #103:

Allow users to just override the zip file write part instead of entire write function.

Summary of changes:

  • ability to specify a media_function which if filled with a valid function can allow customizing to user needs. fallback is standard media write functionality.
  • context manager for sqlite because looks cleaner and autocommits on success. You can drop this part if not to your preference.
  • instead of mkstemp why not use NamedTemporaryFile? I like it because it automatically closes the file upon cleanup due to exit or scope change. mkstemp needs to be manually cleaned and handled which can leave files if interrupted somehow.
  • write package to temp file first, then on success move to final location. This way, an error won't delete an existing package that one may attempt to overwrite. Basically a safety step. This is also the same default behavior for linux zip command line utility. It first writes to temp file in same directory then moves to overwrite.

@yash-fn yash-fn force-pushed the master branch 3 times, most recently from 92d83de to ff05b51 Compare February 7, 2022 04:39
@yash-fn
Copy link
Author

yash-fn commented Apr 15, 2022

@kerrickstaley , should I leave this open?

@yash-fn yash-fn closed this Apr 25, 2022
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