Learn R Programming

crul (version 0.2.0)

writing-options: Writing data options

Description

Writing data options

Arguments

Examples

Run this code
(x <- HttpClient$new(url = "https://httpbin.org"))

# write to disk
(x <- HttpClient$new(url = "https://httpbin.org"))
f <- tempfile()
res <- x$get(disk = f)
res$content # when using write to disk, content is a path
readLines(res$content)

# streaming response
(x <- HttpClient$new(url = "https://httpbin.org"))
res <- x$get('stream/50', stream = function(x) cat(rawToChar(x)))
res$content # when streaming, content is NULL

Run the code above in your browser using DataLab