0

有什么方法可以在不实际下载的情况下获取(远程,http)文件的大小?

所有其他类似的问题似乎都围绕expectedContentLengthNSURLResponse对象中获取,didReceiveResponse:但我不想下载文件,我只想知道它有多大。

4

1 回答 1

3

尝试发出 HEAD 请求,它只返回包含 Content-Length 标头的标头。

~$ curl -I http://google.com/
HTTP/1.1 301 Moved Permanently
Location: http://www.google.com/
Content-Length: 219
...
于 2010-08-03T14:33:00.340 回答