req <- request(example_url()) |>
req_url_path("/stream-bytes/32768")
resp <- req_perform_connection(req)
length(resp_stream_raw(resp, kb = 16))
length(resp_stream_raw(resp, kb = 16))
# When the stream has no more data, you'll get an empty result:
length(resp_stream_raw(resp, kb = 16))
# Always close the response when you're done
close(resp)
Run the code above in your browser using DataLab