我正在尝试下载并保存 Zip 文件。看起来下载可以,但是保存却出错了。如果我尝试解压缩该文件,则会收到以下错误:
Archive: download.zip
error [download.zip]: missing 3208647056 bytes in zipfile
(attempting to process anyway)
error [download.zip]: attempt to seek before beginning of zipfile
(please check that you have transferred or created the zipfile in the
appropriate BINARY mode and that you have compiled UnZip properly)
Run Code Online (Sandbox Code Playgroud)
这是我正在使用的代码:
货物.toml
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
reqwest = { version = "0.10"}
tokio = { version = "0.2", features = ["full"] }
error-chain = "0.12.2"
Run Code Online (Sandbox Code Playgroud)
src/main.rs
Archive: download.zip
error [download.zip]: missing 3208647056 bytes in zipfile
(attempting to process anyway)
error [download.zip]: attempt to seek before beginning of zipfile
(please check that you have transferred or created the zipfile in the
appropriate BINARY mode and that you have compiled UnZip properly)
Run Code Online (Sandbox Code Playgroud)
有人可以帮我吗?
mca*_*ton 10
将reqwest::Response::text尝试解析您的请求正文并用替换字符替换任何无效的 UTF-8 序列。对于二进制文件,这将导致文件损坏。
相反,您需要使用reqwest::Response::bytes它按原样返回内容。
| 归档时间: |
|
| 查看次数: |
8204 次 |
| 最近记录: |