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

[FEATURE] - Provide Ability to Write Downloaded Data to a File #567

Closed
1 task done
briandowns opened this issue Nov 16, 2022 · 8 comments
Closed
1 task done

[FEATURE] - Provide Ability to Write Downloaded Data to a File #567

briandowns opened this issue Nov 16, 2022 · 8 comments
Labels
feature request Discussion about a new feature

Comments

@briandowns
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem?

There doesn't appear to be any way of writing the content retrieved from an HTTP call to a file. I don't have any good suggestions on how to implement this as there are a number of ways to examine. Open to suggestions.

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

@briandowns briandowns added the feature request Discussion about a new feature label Nov 16, 2022
@Jason2605
Copy link
Member

Are you talking about some sort of stream interface for large files or?

@briandowns
Copy link
Contributor Author

Yes, for instance downloading tars, or other files of interest.

@briandowns
Copy link
Contributor Author

I've been giving this some thought and I haven't come up with anything concrete. I wanted to come up with something that wouldn't break the current API but that seems impossible.

Option 1:
Add an optional argument to argument to the get methods of a file path and on existence, a function is given to curl to write the received data to that file.

Option 2:
Introduce a new type to Dictu called Bytes and change the HTTP.Response.content field to be of this type. The caller then chooses what to do with the bytes. We could also add b'all of the bytes'; style

Option 3:
Add a method to the module and on the client to specifically download files.

Option 4:
Another much better option.

@briandowns
Copy link
Contributor Author

I was hoping to work on this issue next week during my company's hackweek. Wanted to get your (@Jason2605 ) thoughts on how you want to see this implemented. Thanks in advance!

@Jason2605
Copy link
Member

I think option 2 is probably the route I would go with introducing a new bytes type, as this is something that will need doing eventually anyways. Once we have a dedicated bytes type we can default the string type to handle unicode chars to bring the string type into the modern era. Probably the most work involved in this option, but I think it's the way to go!

@briandowns
Copy link
Contributor Author

Thank you for the feedback! Will get started on this next week.

@Jason2605
Copy link
Member

Much appreciated, thank you

@briandowns
Copy link
Contributor Author

I found a workout around for this that will not require any new types or adjustments to the HTTP module. I'll submit the PR by tomorrow night. This will open the door to so much. :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Discussion about a new feature
Projects
None yet
Development

No branches or pull requests

2 participants