相关疑难解决方法(0)

使用Curl数据二进制选项,内存不足

我正在尝试使用curl来上传数据。我需要上传二进制数据。

不幸的是,我认为curl首先将文件二进制文件加载到内存中,因此对于大文件来说这是一个问题。我使用的系统的可用内存非常少,因此即使是 8mb 大的文件也很困难,我得到:

curl: option --data-binary: out of memory
curl: try 'curl --help' for more information
Run Code Online (Sandbox Code Playgroud)

我尝试过分块选项,但这似乎也不起作用。

到目前为止,这就是我正在尝试的:

curl --insecure -v --max-time 1200 ... --data-binary @/tmp/sd/record/....mp4 --header Transfer-Encoding: chunked -o UPLOAD_TOKEN -D Media_Binary_Data https://....upload
Run Code Online (Sandbox Code Playgroud)

有没有办法可以阻止文件将二进制文件加载到内存中或强制其将此数据存储在 SD 卡中并从那里读取数据?

bash shell curl google-api

10
推荐指数
1
解决办法
2万
查看次数

使用cURL从Shell发布4GB文件

我尝试将文件大小为4GB的文件发布到REST API。

cURL不会上传具有该大小的文件,而是发布Content-Length:0的文件。

curl -v -i -d @"/work/large.png" -H "Transfer-Encoding: chunked" http://localhost:8080/files
* Adding handle: conn: 0x7fcafc00aa00
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7fcafc00aa00) send_pipe: 1, recv_pipe: 0
* About to connect() to localhost port 8080 (#0)
*   Trying localhost...
* Connected to localhost (localhost) port 8080 (#0)
> POST /files HTTP/1.1
> User-Agent: curl/7.30.0
> Host: localhost:8080
> Accept: */*
> Transfer-Encoding: chunked
> Authorization: bearer XXX.XXX.XXX …
Run Code Online (Sandbox Code Playgroud)

shell curl

3
推荐指数
2
解决办法
1万
查看次数

标签 统计

curl ×2

shell ×2

bash ×1

google-api ×1