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

copy_to_stream() should return count of copied bytes #122

Closed
umesecke opened this issue Oct 10, 2016 · 3 comments
Closed

copy_to_stream() should return count of copied bytes #122

umesecke opened this issue Oct 10, 2016 · 3 comments

Comments

@umesecke
Copy link

The function copy_to_stream() should return the count of copied bytes. Like the PHP function stream_copy_to_stream() does.

Current workaround is to use copy_to_string() and check the length of the returned string but this does not play well for large amounts of data.

@Tobion
Copy link
Member

Tobion commented Oct 13, 2016

Can you give us a use-case this is helpful for please?

@umesecke
Copy link
Author

It'd like to keep track of the amount of copied data and in my case send that number to statsd. As there might be less (or even more) than the requested length ($maxLen) of data copied I'd like to know the exact amount.

I could implement a stream decorator that counts the amount of written data but this doesn't seem to me as the right approach.

@Tobion
Copy link
Member

Tobion commented Jun 9, 2019

Closing as there does not seem enough interest in this from others. Also there is an alternative solution mentioned.

@Tobion Tobion closed this as completed Jun 9, 2019
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

2 participants