This is the most general way of processing the response from the server - you receive the raw bytes as they come in, and you can do whatever you want with them.

write_stream(f)

Arguments

f

Callback function. It should have a single argument, a raw vector containing the bytes recieved from the server. This will usually be 16k or less. The return value of the function is ignored.

Examples

GET("https://github.com/jeroen/data/raw/gh-pages/diamonds.json", write_stream(function(x) { print(length(x)) length(x) }) )
#> [1] 12386 #> [1] 32768 #> [1] 14914 #> [1] 24610 #> [1] 32768 #> [1] 14451 #> [1] 32768 #> [1] 15971 #> [1] 23852 #> [1] 24931 #> [1] 32768 #> [1] 14281 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 10616 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 11253 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 9729 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 10142 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 11984 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 12519 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 13377 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 12618 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 11892 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 10634 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 10186 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 8655 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 12861 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 3185 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 14176 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 25636 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 10162 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 10827 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 23602 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 19657 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 22908 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 17520 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 32768 #> [1] 13492
#> Response [https://raw.githubusercontent.com/jeroen/data/gh-pages/diamonds.json] #> Date: 2017-08-16 14:13 #> Status: 200 #> Content-Type: text/plain; charset=utf-8 #> <EMPTY BODY>