Client side package updates.
This commit is contained in:
@@ -5,7 +5,7 @@ import { useTranslation } from "react-i18next";
|
||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
import cleanAxios from "../../utils/CleanAxios";
|
||||
import formatBytes from "../../utils/formatbytes";
|
||||
import yauzl from "yauzl";
|
||||
//import yauzl from "yauzl";
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
|
||||
import { connect } from "react-redux";
|
||||
@@ -36,7 +36,7 @@ export function JobsDocumentsDownloadButton({
|
||||
);
|
||||
const imagesToDownload = [
|
||||
...galleryImages.images.filter((image) => image.isSelected),
|
||||
...galleryImages.other.filter((image) => image.isSelected),
|
||||
...galleryImages.other.filter((image) => image.isSelected),
|
||||
];
|
||||
|
||||
function downloadProgress(progressEvent) {
|
||||
@@ -69,44 +69,42 @@ export function JobsDocumentsDownloadButton({
|
||||
setDownload(null);
|
||||
if (Direct_Media_Download.treatment === "on") {
|
||||
try {
|
||||
const parentDir = await window.showDirectoryPicker({
|
||||
id: "media",
|
||||
startIn: "downloads",
|
||||
});
|
||||
|
||||
const directory = await parentDir.getDirectoryHandle(identifier, {
|
||||
create: true,
|
||||
});
|
||||
|
||||
yauzl.fromBuffer(
|
||||
Buffer.from(theDownloadedZip.data),
|
||||
{},
|
||||
(err, zipFile) => {
|
||||
if (err) throw err;
|
||||
zipFile.on("entry", (entry) => {
|
||||
zipFile.openReadStream(entry, async (readErr, readStream) => {
|
||||
if (readErr) {
|
||||
zipFile.close();
|
||||
throw readErr;
|
||||
}
|
||||
if (err) throw err;
|
||||
let fileSystemHandle = await directory.getFileHandle(
|
||||
entry.fileName,
|
||||
{
|
||||
create: true,
|
||||
}
|
||||
);
|
||||
const writable = await fileSystemHandle.createWritable();
|
||||
readStream.on("data", async function (chunk) {
|
||||
await writable.write(chunk);
|
||||
});
|
||||
readStream.on("end", async function () {
|
||||
await writable.close();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
// const parentDir = await window.showDirectoryPicker({
|
||||
// id: "media",
|
||||
// startIn: "downloads",
|
||||
// });
|
||||
// const directory = await parentDir.getDirectoryHandle(identifier, {
|
||||
// create: true,
|
||||
// });
|
||||
// yauzl.fromBuffer(
|
||||
// Buffer.from(theDownloadedZip.data),
|
||||
// {},
|
||||
// (err, zipFile) => {
|
||||
// if (err) throw err;
|
||||
// zipFile.on("entry", (entry) => {
|
||||
// zipFile.openReadStream(entry, async (readErr, readStream) => {
|
||||
// if (readErr) {
|
||||
// zipFile.close();
|
||||
// throw readErr;
|
||||
// }
|
||||
// if (err) throw err;
|
||||
// let fileSystemHandle = await directory.getFileHandle(
|
||||
// entry.fileName,
|
||||
// {
|
||||
// create: true,
|
||||
// }
|
||||
// );
|
||||
// const writable = await fileSystemHandle.createWritable();
|
||||
// readStream.on("data", async function (chunk) {
|
||||
// await writable.write(chunk);
|
||||
// });
|
||||
// readStream.on("end", async function () {
|
||||
// await writable.close();
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
// );
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
standardMediaDownload(theDownloadedZip.data);
|
||||
@@ -123,7 +121,7 @@ export function JobsDocumentsDownloadButton({
|
||||
a.click();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
|
||||
Reference in New Issue
Block a user