From 0d698cfefa3e8df47f6de4e85aad4080fedb65df Mon Sep 17 00:00:00 2001 From: Ian Date: Tue, 16 Nov 2021 01:22:12 -0500 Subject: [PATCH] add readbytes! method --- src/Streams.jl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Streams.jl b/src/Streams.jl index 896e5a7fa..489238678 100644 --- a/src/Streams.jl +++ b/src/Streams.jl @@ -310,6 +310,13 @@ function Base.readbytes!(http::Stream, buf::IOBuffer, n=bytesavailable(http)) unsafe_read(http, pointer(buf.data, buf.size + 1), n) buf.size += n end +function Base.readbytes!(http::Stream, buf::IOStream, n=bytesavailable(http)) + nread = 0 + while nread < n + nread += write(buf, readavailable(http, n - nread)) + end + nread +end function Base.read(http::Stream) buf = PipeBuffer()