gpt4 book ai didi

ios - ASIHTTPRequest:(iOS)正确下载数据并将其流式传输到磁盘

转载 作者:行者123 更新时间:2023-11-28 23:11:15 27 4
gpt4 key购买 nike

有没有人对设置 ASIHTTPRequest 以将下载流式传输到磁盘而不是将其全部下载到内存然后写入磁盘的正确方法有大纲?

我试过了,但它似乎没有在接收数据时将其写入磁盘。

ASIHTTPRequest * request = [[ASIHTTPRequest alloc] initWithURL:url];
[request setDownloadDestinationPath:absolutePath];
[request setDownloadProgressDelegate:self];
[request startSynchronous];

我是否需要实现任何委托(delegate)方法才能真正写入磁盘?

谢谢

最佳答案

来自 ASIHTTPRequest 文档:

When downloading data to a file using downloadDestinationPath, datawill be saved in a temporary file while the request is in progress.This file’s path is stored in temporaryFileDownloadPath. When therequest completes successfully, one of two things happen:

If the data is gzip compressed (see information on gzip compression), the compressed file will be uncompressed intodownloadDestinationPath, and the temporary file will be deleted

If the data is not compressed, the temporary file is moved to downloadDestinationPath, overwriting any previous file

所以,是的:它应该在下载时写入文件,但在下载完成之前不会写入最终目的地。

关于ios - ASIHTTPRequest:(iOS)正确下载数据并将其流式传输到磁盘,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8218362/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com