Closed xbridges closed 2 months ago
Thanks published this great library. I tried compress feature on browser. Below is
log in browser develop tool
zip binary data
tried source code.
import { Archive, ArchiveCompression, ArchiveFormat } from "./dist/libarchive.js"; document.getElementById("file").addEventListener("change", async (e) => { try { Archive.init({ workerUrl: "./dist/worker-bundle.js", }); window.Archive = Archive; const file = e.currentTarget.files[0]; const imageFiles = [{ file }]; console.log(imageFiles); const archivedFile = await Archive.write({ files: imageFiles, outputFileName: "test.zip", compression: ArchiveCompression.GZIP, format: ArchiveFormat.ZIP, }); console.log(archivedFile); // download file const a = document.createElement('a'); a.href = URL.createObjectURL(archivedFile); a.download = `test.zip`; a.click(); } catch (err) { console.error(err); } });
I'd like you to point out the bad points please.
Sorry. I will close this issue. I solved it myself. My preparing process was incorrect.
Thanks published this great library. I tried compress feature on browser. Below is
log in browser develop tool
zip binary data
tried source code.
I'd like you to point out the bad points please.