R语言:流式输出到URL

R语言:流式输出到URL,r,httr,jsonlite,R,Httr,Jsonlite,我试图从和端点获取一些日期,然后将其发送到另一个endoint(中间有一些修改) 我的目标是在这两种情况下(输入和输出)都使用流 这就是我所拥有的: library(jsonlite) library(curl) hPOST <- new_handle() hGET <- new_handle() handle_setheaders(hGET, "Authorization"=....) handle_setheaders(hPOST, "Author

我试图从和端点获取一些日期,然后将其发送到另一个endoint(中间有一些修改)

我的目标是在这两种情况下(输入和输出)都使用流

这就是我所拥有的:

library(jsonlite)
library(curl)

hPOST <- new_handle()
hGET <- new_handle()
handle_setheaders(hGET, "Authorization"=....)
handle_setheaders(hPOST, "Authorization"=...., "Content-Type"="application/octet-stream")

# to mark it as a POST
handle_setform(hPOST)

con_out <- curl(POST_URL, handle=hPOST)
#con_out <- stdout() // this works
con_in <- curl(GET_URL, handle=hGET)

inputs <- stream_in(con_in, handler = function(df){
    # some changes to df... and then save it
    stream_out(df, con_out, pagesize = 1)
}, pagesize = 1)

close(con_out)
library(jsonlite)
图书馆(curl)

hPOST为什么不直接用
httr::GET
读取它,然后用
httr::POST
将结果发送回来呢?因为我没有找到用流调用POST的方法。我将处理大数据,所以我真的需要使用streamsHave。你看了吗?我已经检查了该库,但似乎对我需要的没有帮助。即使我可以使用它提供的write_流函数,连接也不能以“write”的形式打开。。我得到了与之前相同的错误“错误在open.connection(con,open=mode):只能打开URL进行读取”