alist icon indicating copy to clipboard operation
alist copied to clipboard

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

Open Masterlovsky opened this issue 2 years ago • 12 comments

Please make sure of the following things

  • [X] I have read the documentation.
  • [X] I'm sure there are no duplicate issues or discussions.
  • [X] I'm sure this feature is not implemented.
  • [X] 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 avatar Aug 29 '23 07:08 Masterlovsky

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

SeanHeuc avatar Sep 03 '23 06:09 SeanHeuc

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[bot] avatar Oct 17 '23 06:10 stale[bot]

强烈支持!

ghost avatar Nov 10 '23 14:11 ghost

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

SheltonZhu avatar Jan 20 '24 03:01 SheltonZhu

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

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

SheltonZhu avatar Jan 20 '24 16:01 SheltonZhu

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 avatar Jan 21 '24 17:01 SheltonZhu

解压部分可参考实验性代码 https://github.com/SheltonZhu/alist/commit/ebee35df2f9ba878c1a43badcb68070c76b51838?diff=unified&w=0

SheltonZhu avatar Jan 21 '24 17:01 SheltonZhu

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

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

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

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

xhofe avatar Jan 22 '24 05:01 xhofe

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

ghost avatar Mar 09 '24 07:03 ghost