Skip to content

Allow specifying destination directory and filename in get() #158

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

Closed

Conversation

lordcirth
Copy link
Contributor

Resolves #48 , #110

Copy link
Contributor

@ntninja ntninja left a comment

Choose a reason for hiding this comment

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

Thanks for this! I left some comments since I'm not really happy with some of you choices, but it's great that this is finally being addressed. 👍

(Also the indentation is completely broken – please fix!)

@@ -307,6 +313,11 @@ def download(self, path, args=[], filepath=None, opts={},
with tarfile.open(fileobj=res.raw, mode=mode) as tf:
tf.extractall(path=wd)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please iterate over the fsnodes of the received tar file using TarFile.next(), extracting each of them using them using the TarFile.extract() method rather then moving them around like this after the fact.

Defaults to the current working directory.
If the directory does not exist, it will be created.
filename : str
The filename to store the file as.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need two parameters here? Why not just have a path relative to the current working directory whose basename will be the filename of the object to download (meaning that the file at the path will be either a file or a directory depending on its actual type)?

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.

2 participants