Upgrade to new jszip #1055
No reviewers
Labels
No Label
DBF
Dates
Defined Names
Features
Formula
HTML
Images
Infrastructure
Integration
International
ODS
Operations
Performance
PivotTables
Pro
Protection
Read Bug
SSF
SYLK
Style
Write Bug
good first issue
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sheetjs/sheetjs#1055
Loading…
Reference in New Issue
No description provided.
Delete Branch "master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
jszip v3 has async functions that return promises instead of blocking the thread.
I've adapted the code and all the tests to run with the new version.
Of course there would be some missing parts: documentation is not updated (now xlsx.read and xlsx.write return promises)
It won't work in older browsers as I'm heavily using async await, probably babel could be used. For my purposes, which is using the library in Node 8, it is enough, but maybe you are interested in the changes.
cheers
This pr is related to a couple of issues #600 #1017 #869 #408
@furstenheim to be clear, promises are "deferred". When the actual work is being done, it will still block the main thread (pure JS is still single-threaded, not too dissimilar to Python). Promises don't magically make things run off the main thread -- they merely shift the timing. Platform APIs have to provide the functionality in a way that doesn't block the main thread, like the
zlib
bindings in nodejs. The situation is similar to how NumPy circumvents the Python global interpreter lock.To see this, try running the following command in your node shell:
setTimeout and most promise APIs don't preempt the execution.
If you want to process off the main thread in nodejs, check the
server
demo for a few strategies. You can usechild_process.fork
with a simple JS script or useexec
to call thexlsx
bin script or use thetiny-worker
Web Worker "shim"Note: If you want to process off the main thread in web browser, the standard technique is to use a Web Worker.
@SheetJSDev it does make things "magical" because by deferring heavy calculation/work you are not blocking higher priority events which results in smoother experience at least for browser users.
Pull request closed