Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

能否支持zip、tar等压缩包的在线内容预览 #5114

Closed
4 tasks done
Masterlovsky opened this issue Aug 29, 2023 · 14 comments · Fixed by #7817
Closed
4 tasks done

能否支持zip、tar等压缩包的在线内容预览 #5114

Masterlovsky opened this issue Aug 29, 2023 · 14 comments · Fixed by #7817
Labels
enhancement New feature or request

Comments

@Masterlovsky
Copy link

Please make sure of the following things

  • I have read the documentation.
  • I'm sure there are no duplicate issues or discussions.
  • I'm sure this feature is not implemented.
  • I'm sure it's a reasonable and popular requirement.

Description of the feature / 需求描述

实现类似于tar -tvf的效果

Suggested solution / 实现思路

No response

Additional context / 附件

No response

@Masterlovsky Masterlovsky added the enhancement New feature or request label Aug 29, 2023
@SeanHeuc
Copy link
Contributor

SeanHeuc commented Sep 3, 2023

https://pkg.go.dev/archive/zip#NewReader
zip来说似乎只要有io.ReaderAt实现就可以快速列目录和文件,似乎代码改动不大

@stale
Copy link

stale bot commented Oct 17, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale No activity for more than 30 days label Oct 17, 2023
@xhofe xhofe added the pr-welcome Welcome to pull request label Oct 23, 2023
@stale stale bot removed the stale No activity for more than 30 days label Oct 23, 2023
@ghost
Copy link

ghost commented Nov 10, 2023

强烈支持!

@SheltonZhu
Copy link
Contributor

这个想做的话得前端做吧?因为不管302还是proxy最终给到前段的都是一个url,后端做的话必须下载下来,读取文件

@SheltonZhu
Copy link
Contributor

https://pkg.go.dev/archive/zip#NewReader zip来说似乎只要有io.ReaderAt实现就可以快速列目录和文件,似乎代码改动不大

zip 格式 好像有通过range header 实现io.ReadAt 的https://github.com/snabb/httpreaderat

@SheltonZhu
Copy link
Contributor

https://github.com/mholt/archiver 可以实现rar,7z,zip,tar的解压,压缩方式涵盖了,bz2,gzip,xz,等多种。
https://github.com/snabb/httpreaderat 可以通过http range 头实现 io.ReadAt接口
目前实验下来只有zip和7z支持快速列目录和文件

目前实验性的写了几个接口可以做到,平铺所有层级目录文件,或者像文件系统一样一级一级查看,实现在服务器上只下载压缩包内指定文件。

但是目前不知道alist想怎么设计这个功能,比如权限设计,接口参数设计,缓存设计等。我觉得这个功能甚至可以单独作为一个插件,通过提供下载链接(不论302还是代理),在线解析压缩包目录,下载指定文件(如果要支持在线播放,可能还要能支持(range header)。
@xhofe

@SheltonZhu
Copy link
Contributor

解压部分可参考实验性代码
SheltonZhu@ebee35d?diff=unified&w=0

@xhofe
Copy link
Collaborator

xhofe commented Jan 22, 2024

mholt/archiver 可以实现rar,7z,zip,tar的解压,压缩方式涵盖了,bz2,gzip,xz,等多种。 snabb/httpreaderat 可以通过http range 头实现 io.ReadAt接口 目前实验下来只有zip和7z支持快速列目录和文件

目前实验性的写了几个接口可以做到,平铺所有层级目录文件,或者像文件系统一样一级一级查看,实现在服务器上只下载压缩包内指定文件。

但是目前不知道alist想怎么设计这个功能,比如权限设计,接口参数设计,缓存设计等。我觉得这个功能甚至可以单独作为一个插件,通过提供下载链接(不论302还是代理),在线解析压缩包目录,下载指定文件(如果要支持在线播放,可能还要能支持(range header)。 @xhofe

因为临近毕业,最近在忙着写毕业论文,所以暂时不会思考添加新的feature

@ghost
Copy link

ghost commented Mar 9, 2024

@xhofe 求merge,这个功能太实用了!

@UVJkiNTQ
Copy link

UVJkiNTQ commented Oct 2, 2024

现在有考虑支持吗?

@owendswang
Copy link

等一个支持……

@Rirmach
Copy link
Contributor

Rirmach commented Oct 19, 2024

如果在线列出压缩包内目录树实现有难度,是否可以先解压到当前目录?

@xixky
Copy link

xixky commented Jan 9, 2025

安卓的MiXplorer软件已经实现了压缩包预览,说明是可以实现的

@Clouddark75
Copy link

Clouddark75 commented Jan 13, 2025

Android's MiXplorer software has implemented compressed package preview, which means it is possible

It's possible because Zip support random reads. That's the reason why you can view or preview zip files over http or a network.
The story is different for other formats, as 7z or Rar files and others, because they don't support random reads. You need to cache or extract the whole thing to some point.

@github-actions github-actions bot removed the pr-welcome Welcome to pull request label Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants