Skip to content

Commit

Permalink
add readbytes! method
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Nov 16, 2021
1 parent 37b2f31 commit 0d698cf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Streams.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 0d698cf

Please sign in to comment.