stub in zip library
This commit is contained in:
parent
f7b00af7d9
commit
bab0a13a14
6 changed files with 31 additions and 2 deletions
|
|
@ -15,7 +15,9 @@ let KIRI = self.kiri = self.kiri || {},
|
|||
syncd = {},
|
||||
running = {},
|
||||
slicing = {},
|
||||
worker = null;
|
||||
worker = null
|
||||
// occ = new Worker("/kiri/ext/occ-worker.js", {type:"module"}),
|
||||
;
|
||||
|
||||
/**
|
||||
* @param {Function} fn name of function in KIRI.worker
|
||||
|
|
@ -243,6 +245,12 @@ KIRI.work = {
|
|||
output(reply.done);
|
||||
}
|
||||
}, [ data.png ]);
|
||||
},
|
||||
|
||||
zip: function(files) {
|
||||
send("zip", {files}, reply => {
|
||||
console.log({zip_said: reply});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -536,6 +536,24 @@ KIRI.worker = {
|
|||
// send.done({done: {verts, faces, bigv, vi, ii}}, [ bigv.buffer ]);
|
||||
send.done({done: {bigv}}, [ bigv.buffer ]);
|
||||
});
|
||||
},
|
||||
|
||||
zip: function(data, send) {
|
||||
let { files } = data;
|
||||
let zip = new JSZip();
|
||||
for (let file of files) {
|
||||
zip.file(file.name, file.data);
|
||||
}
|
||||
zip.generateAsync({
|
||||
type: "uint8array",
|
||||
compression: "DEFLATE",
|
||||
compressionOptions: { level: 3 },
|
||||
streamFiles: true
|
||||
}, progress => {
|
||||
send.data(progress);
|
||||
}).then(output => {
|
||||
send.done(output);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue