在R上传超过2.15 GB的文件

我有一个手动过程,我正在上传5-6 GB的文件通过curl的Web服务器:

curl -X POST --data-binary @myfile.csv http://myserver::port/path/to/api 

这个过程工作正常,但我很想使用R自动化它。问题是,我要么不知道我在做什么,或者curl的R库不知道如何处理大于2GB的文件:

 library(RCurl) postForm( "http://myserver::port/path/to/api", file = fileUpload( filename = path.expand("myfile.csv"), contentType = "text/csv" ),.encoding="utf-8") 

Yeilds Error: Internal Server Error

httr也不起作用:

 library(httr) POST( url = "http://myserver:port/path/to/api", body = upload_file( path = path.expand("myfile.csv"), type = 'text/csv'), verbose() ) 

这产生:

 Response [http://myserver:port/path/to/api] Date: 2015-06-30 11:11 Status: 400 Content-Type: <unknown> <EMPTY BODY> 

使用verbose()选项,httr有点更丰富,告诉我:

 -> POST http://myserver:port/path/to/api -> User-Agent: libcurl/7.35.0 r-curl/0.9 httr/1.0.0 -> Host: http://myserver::port -> Accept-Encoding: gzip, deflate -> Accept: application/json, text/xml, application/xml, */* -> Content-Type: text/csv -> Content-Length: -2147483648 -> Expect: 100-continue -> <- HTTP/1.1 400 Bad Request <- Server: Apache-Coyote/1.1 <- Transfer-Encoding: chunked <- Date: Tue, 30 Jun 2015 11:11:11 GMT <- Connection: close <- 

Content-Length: -2147483648看起来像一个32位整数溢出可疑,所以我认为这是一个错误httr。 我怀疑RCurl正在经历类似的失败。

我真的很喜欢curl -X POST --data-binary的最小包装,但是除了这个,我可以从R上传相当大的文件吗?

这个bug在httr / curl的dev版本中被修复:

 devtools::install_github("jeroenooms/curl") devtools::install_github("hadley/httr") 

这是R的httr和curl包中的一个错误。 截至 2015年7月2日,该错误已在GitHub上修复 ,并且更改将很快推出到CRAN。

也有可能我在上面的命令中错误地调用了RCurl,但我永远无法弄清楚正确的调用。