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

Upload file from string or file-like object #5

Open
giovannipizzi opened this issue Nov 29, 2021 · 1 comment
Open

Upload file from string or file-like object #5

giovannipizzi opened this issue Nov 29, 2021 · 1 comment

Comments

@giovannipizzi
Copy link

The method simple_upload(self, machine, sourcePath, targetPath) requires the source file to be an actual file on disk. There are cases (e.g. uploading a simple short text file) where the content is in memory (in a string, or in a file-like object - e.g. an already open file). Would it be possible to support passing the content or a file-like object, or this is complicated? (For now, I need to create a NamedTemporaryFile to upload the content, is this the suggested approach?)

@giovannipizzi
Copy link
Author

Similarly, I just realised that in simple_upload, the targetPath must be a folder (and the file will get the same filename as the source file). Is it possible to specify instead the destination filename? (This actually prevents even using a NamedTemporaryFile, I have to use a TemporaryDirectory and create a file with the correct name, and then transfer to the folder).

Even if there is no plan to change it, I suggest to clarify the docstring (now it says targetPath: the absolute target path that I would interpret as the path of the destination file)

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

No branches or pull requests

1 participant