curl 设置上传块大小

fen*_*tas 7 bash curl file-upload chunks

我想上传一个大文件curl。为此,我想将其拆分,而不将其保存到磁盘(就像使用split)。--continue-at我尝试与 一起使用Content-Length

curl -s \
      --request PATCH \
      --header "Content-Type: application/offset+octet-stream" \
      --header "Content-Length: ${length}" \
      --header "Upload-Offset: ${offset}" \
      --continue-at "${offset}" \
      --upload-file "${file}" \
      "${dest}"
Run Code Online (Sandbox Code Playgroud)

curl“过冲”并忽略了Content-Length。有类似的东西--stop-at吗?或者,如果有必要,我必须使用dd

编辑 dd解决方案:

curl -s \
      --request PATCH \
      --header "Content-Type: application/offset+octet-stream" \
      --header "Content-Length: ${length}" \
      --header "Upload-Offset: ${offset}" \
      --data-binary "@-" \
      "${dest}" < <(dd if=${file} skip=${offset} count=${length} iflag=skip_bytes,count_bytes 2>/dev/null)
Run Code Online (Sandbox Code Playgroud)

但如果可能的话我想只使用 cURL..