下载之前如何查看 rar 或 zip 文件内容?

发布于 2024-10-01 04:31:24 字数 1459 浏览 8 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

姜生凉生 2024-10-08 04:31:24

编辑:根据评论,添加链接摘要页面中的建议。截至 2018 年 6 月,其中一项可能已过时。


这些 帮忙?他们提供了两种解决方案:

Edit: per comment, adding the suggestions from the linked summary page. One may be outdated as of 2018-06.


Would THESE help? They offer two solutions:

寄人书 2024-10-08 04:31:24

一般来说,这是不可能的。要查看某些内容,您必须至少下载其中的一部分。

但是,您可以下载存档的标题(针对特定格式)并阅读。如果它包含文件名和大小的列表,那么在下载整个文件之前,这应该为您提供足够的信息来“查看内容”。

大多数格式都有一个已知长度的标头段(或记录在文件的前几个字节中),因此获取前 8 个字节(4 个字节表示类型,4 个字节表示标头长度),然后是其余部分标头(基于长度)可能是可行的。不过似乎有点尴尬。

在非固体存档的情况下,您还可以从服务器请求与文件相对应的特定块,但我不确定您将如何解压缩它。

In general principle, this isn't possible. To view something, you have to download at least part of it.

However, you may be able to download the header of the archive (for particular formats) and read that. If it contains a list of filenames and sizes, that should give you enough information to "view the content" before downloading the entire file.

Most formats have a header segment with a known length (or recorded in the first few bytes of the file), so grabbing the first 8 bytes (4 for the type and 4 for the header length, let's say), then the rest of the header (based on the length) may be viable. It seems a bit awkward though.

In the case of a non-solid archive, you could also request a particular chunk corresponding to a file from the server, but I'm not sure how you'd go about decompressing it.

白馒头 2024-10-08 04:31:24

对于 ZIP 存档,这是不可能的,因为存储在存档中的有关文件的信息位于存档的末尾(中央目录)和每个压缩文件之前,即压缩文件数据第二个文件等。
因此,您只能查看存档中第一个文件的信息,要查看下载数据所需的所有进一步信息。

For ZIP archive this is not possible, since information about files, stored in archive is located at the end of archive (central directory) and before each compressed file, i.e. compressed file data second file and so on.
So, you can only see information about first file in archive, and to see all further info you need to download data.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文