What does bufferedWrite do? #249
-
Could you please explain what |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
When |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot for the detailed clarification, that's very clear. I guess it would be great to have this in the documentation. |
Beta Was this translation helpful? Give feedback.
-
I agree this should be documented. Meanwhile, I created a discussion thread here: https://github.com/gildas-lormeau/zip.js/discussions/237 in order to keep it visible. |
Beta Was this translation helpful? Give feedback.
When
bufferedWrite
is set totrue
, zip.js creates a separate buffer for each entry being created to avoid data corruption in the zip file. However, when it's set tofalse
, zip.js can still detect ifZipWriter#add
is called in parallel and create automatically the buffers if necessary. In this case, the entry added via the first call toZipWriter#add
is blocking because zip.js did not know there would be concurrent writes. So the performance depends on the size of the first entry added in the zip. That's the reason why you should setbufferedWrite
totrue
when you know you will callZipWriter#add
multiple times in parallel. Any value is safe though.Finally, note that the option
keepOrder
…