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

"Handling Streaming Responses" buffers the file in memory #116

Closed
bra-fsn opened this issue Oct 21, 2015 · 1 comment
Closed

"Handling Streaming Responses" buffers the file in memory #116

bra-fsn opened this issue Oct 21, 2015 · 1 comment

Comments

@bra-fsn
Copy link

bra-fsn commented Oct 21, 2015

Hi,

The following example on http://treq.readthedocs.org/en/latest/howto.html:

def download_file(reactor, url, destination_filename):
    destination = file(destination_filename, 'w')
    d = treq.get(url)
    d.addCallback(treq.collect, destination.write)
    d.addBoth(lambda _: destination.close())
    return d

buffers the whole file in memory, making the process use 5+ GiB when downloading a 4 GiB file.
Is this intended?

@bra-fsn
Copy link
Author

bra-fsn commented Oct 21, 2015

OK, read the code and found treq.get's undocumented unbuffered option.
So with treq.get(url,unbuffered=True), the response is not buffered into memory.
Could you please document it?

pawelmhm pushed a commit to pawelmhm/treq that referenced this issue Nov 4, 2016
Correct RST syntax for CompatibilityPolicy link
twm added a commit to twm/treq that referenced this issue Dec 2, 2016
twm added a commit to twm/treq that referenced this issue Dec 7, 2016
twm added a commit to twm/treq that referenced this issue Dec 9, 2016
@glyph glyph closed this as completed in 6eaa80b Dec 22, 2016
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