Closed zakstucke closed 5 months ago
Your analysis is correct. The file name buffer is used twice in the stream — in the file header and the central repository (the "index" of the archive) — and of course it can't be transferred twice (which is happening because you're running client-zip in the client window, and the Native File System adapter is transferring the stream to the Service Worker).
Great. Thanks!
I'll publish this evening.
Love the library. I encountered a very weird issue i painstakingly debugged, resulting in this PR.
Setup:
ArrayBuffer
chunks, rather than a blob or file (not sure if relevant, but could be)Error occurs on closing the zip (i.e. once all files have been included and the stream is being closed by client-zip) Firefox error:
MessagePort.postMessage: attempting to access detached ArrayBuffer
Safari error:
Unhandled Promise Rejection: DataCloneError: The object can not be cloned.
The firefox error is the actual cause, the safari one gets hidden behind the above opaque one.
What I think is happening and why this PR fixes it:
file.encodedName
ends up getting sent twice during the zipping process, probably with the file, and in the zip's manifestThis change works for me now on both safari and firefox.
Thanks!