await fetch(`${s3_imageUrl}`,
{
method: 'GET',
});
-> origins 설정을 모든 출처 접근가능 허용인 "*"로 수정
해당부분까지 했을 때 해결을하였다는 글을 많이 찾아보았습니다
근데 저는 해결이 안되고 특정부분에서 CORS 오류가 지속적으로 발생하였습니다
await fetch(`${s3_imageUrl}`,{
method: 'GET',
mode: 'cors',// mode: "cors", // same-origin, no-cors
cache: 'no-store',
}
해당부분 2개로 CORS 오류를 해결하였습니다
npm install jszip
let zip = new JSZip();
await fetch(${s3_imageUrl}, {
method: 'GET',
mode: 'cors',
cache: 'no-store',
})
.then(async (response) => {
const arrayBuffer = await response.arrayBuffer();
const filename = `${파일명}.png`;
zip.file(filename, arrayBuffer, { binary: true });
})
.catch((err) => {
console.log(err);
});
zip.generateAsync({ type: 'blob' }).then((content) => {
download({ fileName: `${폴더명}.zip`, data: content });
});
정상적으로 다운로드 되는것을 알 수있었습니다!
작업코드에서 필수적인 코드만 가져온 코드들 입니다