douyue7408 2011-11-24 12:29
浏览 38
已采纳

如何在运行中将文件压缩并传递给浏览器?

I would like to implement feature like GMail's "get all attachments as zipped file".

Is there a way to select multiple files on server, zip them and on-the-fly pass-through to browser? (something similar to PHP's function readfile used for attachments streaming)

[EDIT]

It seems you misunderstood my intentions, all given examples require to create and close archive before its being sent, I want to stream while archive is created.

Something like unix command (from zip manual): zip -r - . | dd of=/dev/nrst0 obs=16k

[EDIT2]

I have tons of ~2MB files (> 100) to serve, waiting for creation of tmp zip file forces to implement queuing mechanisms and takes storage space... If it can be done through stream/pipe directly to browser, why I should write tmp zip in filesyetm?

  • 写回答

2条回答 默认 最新

  • dsgwdigu84950 2011-11-24 12:36
    关注

    Have a look at ZipStream-PHP library - it claims to do what you need.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥170 如图所示配置eNSP
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥15 键盘指令混乱情况下的启动盘系统重装