Open jelveh opened 7 months ago
can you elaborate more on this issue
i didnt see any progress window while using zip operation. Its just displaying a buffering animation and doing the task. Should I add the cancel button there or what?
i didnt see any progress window while using zip operation. Its just displaying a buffering animation and doing the task. Should I add the cancel button there or what?
Yes, that's the progress window. It doesn't currently show how complete the task is, but eventually it will.
When I tried to solve this problem, I found that jszip
unsupport cancel. What should I do next?
this sucks. Let me think about it a little.
jszip
seems to have stopped being developed a couple of years ago, so it's unlikely we could get it modified to add cancellation. But maybe we could fork it.
Alternatively, archiver looks like a decent alternative that does support aborting a request.
Hey @jelveh, @AtkinsSJ, I'd love to take a look at this issue. It might take some time given the fact that the original lib has not been updated in over 2 years. Our best bet might be to swtich over to a new lib. One that I had in mind was fflate, as mentioned on the original jsZip issues page. I'd also take a look at Archiver as suggested by @AtkinsSJ, I think Archiver as well has an abort module coded in.
Please let me know in case I can take it up.
Hey @4nshuman. Go for it! I'm open to changing the module used for zim/unzip. fflate seems interesting, though it seems to have been inactive for several months.
Let me know if you need help.
Hi @jelveh, I looked into the available npm modules and I think I'll be proceeding with Archiver, it has better documentation and also has active development ongoing. This is gonna take some time but rest-assured I'm working on this.
Thank you for the update @4nshuman. Sounds like a good choice. Let me know if you need help along the way.
Hey @jelveh. So I tried integrating the Archiver library onto Puter's client side compression mechanism. But there's a hiccup. Archiver is designed to be used server side and I tried to browserify it using polyfills and webpack, but the fs module just breaks the port. As I understand the puter JSOS uses the puter SDKs fs system for file management, I tried to plug it onto the Archiver port but the webpack browserification still broke apart. I feel that even if I manage to port Archiver at this point it'd be an overkill. Hence I'd like to proceed with fflate for time being. Please let me know of your thoughts/ideas to better implement this issue.
PS: Attaching some snaps from my unsuccessful attempt at porting Archiver for client side.
Hello @jelveh,
So I've been working on this issue for the last couple of weeks, and here's something interesting that I've noticed. On the current instance of Puter, the zip functionality seems to be broken:
Puter.com:
When zipping a file/folder the size does not reduce and the file remains bloated. I was out to add a cancel functionality to the zipping mechanism but ended up fixing this issue as well:
I have a PR in draft with the zipping functionality complete. While I am still working on the unzip mechanism with the new fflate library, I'd appreciate your comments on the current draft PR : https://github.com/HeyPuter/puter/pull/787
Hi @4nshuman. I missed your previous comment, sorry about that! Thank you for the detailed write-up and for going really deep into this. I'm going to review it soon and get back to you.
Description:
Currently, when performing a zip operation on files or folders, a progress window is displayed to inform the user of the ongoing process. However, this progress window lacks a cancellation option. This means that users have no way to interrupt the zipping process once it has started, aside from potentially having to refresh Puter, which is neither convenient nor safe.
Suggested Solution
Implement a "Cancel" button within the progress window of zip operations. This button would allow users to safely terminate the zip process at any point.