simplify file loading
This commit is contained in:
parent
4cb7e8d2ac
commit
1849f95b4e
@ -456,14 +456,7 @@ function jsonLoadInt(url) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function zipLoadDb(archive, indexLoaded, termsLoaded, kanjiLoaded) {
|
function zipLoadDb(archive, indexLoaded, termsLoaded, kanjiLoaded) {
|
||||||
return JSZip.loadAsync(archive).then(files => {
|
return JSZip.loadAsync(archive).then(files => files.files).then(files => {
|
||||||
const fileMap = {};
|
|
||||||
files.forEach((path, file) => {
|
|
||||||
fileMap[path] = file;
|
|
||||||
});
|
|
||||||
|
|
||||||
return fileMap;
|
|
||||||
}).then(files => {
|
|
||||||
const indexFile = files['index.json'];
|
const indexFile = files['index.json'];
|
||||||
if (!indexFile) {
|
if (!indexFile) {
|
||||||
return Promise.reject('no dictionary index found in archive');
|
return Promise.reject('no dictionary index found in archive');
|
||||||
|
Loading…
Reference in New Issue
Block a user