>我有一个水管工休息 api,我有一个发布请求,它发送一个 excel 文件
当我像这样访问请求对象时
这是我得到的属性:
formContents <- Rook::Multipart$parse(req)
formContents$upload
这就是我得到的
["app_x_browser.xlsx","/tmp/RtmpWOKV2O/Multipart1d3261d35443","application/octet-stream","Content-Disposition: form-data; name="upload"; filename="app_x_browser.xlsx"rnContent-Type: application/octet-stream"]
如何从此 JSON 数据将此响应保存在光盘上? 无论如何都可以提取数据并将其保存到文件中吗?
我认为您可以尝试以原始格式发送 xlsx 文件,并在您的 plummer 文件中包含类似的东西
xlsx <- "path/to/xlsxfile.xlsx"
readBin(xlsx, "raw", n=file.info(xlsx)$size)
那么当然,您需要使用API请求来处理此问题
[your call to the api] > results.xlsx
希望这有帮助