JSZip 문제

JJVoiture·2023년 5월 9일
0

문제 상황

JSZip으로 업로드한 zip 파일 속 파일을 unzip 하는데 2GB 이상의 파일에 대해서는

async function handleUnzip(zipFile) {
  const zip = new JSZip();
  const files = await zip.loadAsync(zipFile);
}

loadAsync 메소드가 아래의 에러를 반환한다.

DOMException: The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.

원인 파악

ArrayBuffer 문제인 거 같다. OS에 의해 JS를 동작시키는 프로그램에게 할당된 메모리 이상의 Buffer가 들어오면 제대로 동작하지 않는 것이다.
Chrome의 array buffer는 2GB이므로 그 이상의 용량을 넣은 경우에 에러가 일어나는 것이다.

profile
안녕하세요.

0개의 댓글