F = [
{
name: 'laptop',
url: 'https://res.cloudinary.com/dbxcernxw/image/upload/v1674379837/Mridul.Tech%20Blog/pexels-laptop_tfnlrg.jpg',
type: 'jpeg',
},
{
name: 'coding-react-js',
url: 'https://res.cloudinary.com/dbxcernxw/image/upload/v1674379837/Mridul.Tech%20Blog/pexels-react-code_gkeio5.jpg',
type: 'jpeg',
},
{
name: 'coding-python',
url: 'https://res.cloudinary.com/dbxcernxw/image/upload/v1674379837/Mridul.Tech%20Blog/pexels-python-code_qau1ba.jpg',
type: 'jpeg',
},
{
name: 'coding-pdf',
url: 'https://zip-download-next-js.vercel.app/assets/photos-pdf.pdf',
type: 'pdf',
},
];
const remoteZips = F.map(async (file) => {
const response = await fetch(file.url);
const data = await response.blob();
zip.file(`${file.name}.${file.type}`, data);
return data;
});
But I’m getting this error:
⨯ node_modules/jszip/lib/utils.js (479:16) @ eval
⨯ unhandledRejection: Error: Can't read the data of 'coding-react-js.jpeg'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?
at eval (webpack-internal:///(rsc)/./node_modules/jszip/lib/utils.js:417:44)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
null
Wall of text. Please read @rulesforthedevs and use one of the suggested pastebins
try response.arrayBuffer() ?
Обсуждают сегодня