stub in zip library
This commit is contained in:
parent
f7b00af7d9
commit
bab0a13a14
6 changed files with 31 additions and 2 deletions
1
app.js
1
app.js
|
|
@ -299,6 +299,7 @@ const script = {
|
|||
"kiri",
|
||||
"ext/three",
|
||||
"ext/pngjs",
|
||||
"ext/jszip",
|
||||
"license",
|
||||
"ext/clip2",
|
||||
"ext/earcut",
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
"connect": "^3.7.0",
|
||||
"earcut": "^2.2.2",
|
||||
"express-useragent": "^1.0.13",
|
||||
"jszip": "^3.5.0",
|
||||
"level": "^6.0.1",
|
||||
"leveldown": "^5.6.0",
|
||||
"levelup": "^4.4.0",
|
||||
|
|
|
|||
1
src/ext/jszip.js
Symbolic link
1
src/ext/jszip.js
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/jszip/dist/jszip.js
|
||||
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -405,7 +405,7 @@
|
|||
indices = indices.appendAll(flats).sort((a,b) => b-a);
|
||||
// console.log('indices', ...indices, {zBottom, slicer});
|
||||
if (op.outside && !op.inside) {
|
||||
console.log({outline_bypass: indices, down: op.down});
|
||||
// console.log({outline_bypass: indices, down: op.down});
|
||||
indices.forEach((ind,i) => {
|
||||
if (flats.indexOf(ind) >= 0) {
|
||||
// exclude flats
|
||||
|
|
|
|||
Loading…
Reference in a new issue