Created
September 16, 2020 14:09
-
-
Save royashbrook/4ab180673a9d50e734bae481e176d8c4 to your computer and use it in GitHub Desktop.
From JSZip to unzipit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//import or add cdn for global, url should be passed in somehow | |
fetch(url) | |
.then(r=>r.blob()) | |
.then(JSZip.loadAsync) | |
.then(zip=>zip.files[Object.keys(zip.files)[0]].async('string')) | |
.then(JSON.parse) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//import or add cdn for global, url should be passed in somehow | |
unzip(url) | |
.then(x => x.entries[Object.keys(x.entries)[0]]) | |
.then(x => x.blob()) | |
.then(x => x.text()) | |
.then(JSON.parse) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment