-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Issue/zip operation #787
Issue/zip operation #787
Conversation
…zipping operations
Thanks again for taking care of this issue. A lot of users will appreciate this feature being implemented quickly. I'll review this soon. |
Testing this right now. The first pass looks amazing! Will circle back with more testing. |
The unzip functionality is also pushed, let me know in case you find something that can be optimised. I could use some help on the percentage calculation for the progress window, current iteration runs on a couple of assumptions. Let me know if you have some ideas on a better implementation. |
This is pretty awesome. I still haven't found issues! Could you elaborate on the percentage calculation? What can I help you with? it seems to be working well. |
@jelveh Now this progress counter option is currently not supported on the write.js and the read.js from the file sub-system on the Puter SDK. Now that means we'll have to calculate the percentage of file read and written on the fly within the helper module itself and that calculation comes with some assumptions, since we cannot calculate the exact percentage while the operation is in progress. We need to wait for a read/write operation to complete and then compute the percentage. This same issue persists with the fflate/JSzip/Archiver libraries as well, they do not have an internal progress counter, so we need to do the calculation for them. So all that being the preface, I came up with some percentage calculations of my own : I assume that converting the blobs to uInt8Array would take somewhere up-to 60% then zipping would take another ~23% and writing another ~14%. This leaves a bit of buffer in case things got slowed down and took longer than expected. Do you think we could better implement this somehow to get rid of the assumption ? TLDR : there's no progress counter on write.js and read.js just like the one that exists on upload.js. So I am calcualting the percantage manually on helper for these 2 operations(read and write) P.S : Apologies for the really long description on this, please feel free to reach out to me in case of any queries. |
Thank you for the detailed response. Come to think of it, I used a spinner because I didn't have time to implement a progress bar for zipping. Very glad you picked it up! I need to think about this a little more and will get back to you soon. Thanks again. |
@jelveh |
Thank you @4nshuman. That would be awesome! Do you think you could implement progress bar for the copy/move operations? This is something users really wanted but we haven't gotten around to implementing yet. Let me know and I'll create an issue. If you want to go for read and write, we could do that too! |
@4nshuman upon further testing (before I get to progress), this looks really good. I haven't found any bugs yet! There is one important optimization note though. Oftentimes users may want to unzip directories with many subdirectories and files, that's why it would be more optimized to use the Let me know your thoughts or if you need help with this. |
Hey @jelveh , About the optimization, So If I am understanding this correctly, you would like us to use the upload module to write the files instead of manually triggering the write module correct ? |
Will do! Thanks again :)
For cases such as unzipping, I tested your code a lot and it's working beautifully! I look forward to merging and pushing to prod soon ✌️ |
This needs me to convert the incoming unzipped object to a list of DirectoryEntries and Files since upload module uses this list to create the actual files. I'll need some time to work on this, will update back soon.
Looking forward to it @jelveh ! |
Hey @jelveh , @KernelDeimos, |
woohooo! Testing now 🔥 |
Beautiful! Thank you @4nshuman for the amount of time and effort you put into this awesome PR. Users will deeply appreciate this reimplementation. |
This PR, when complete, will solve the issue #116