Skip to content

Need code of create zip download with large image size files #85

Answered by 101arrowz
sannysoni123 asked this question in Q&A
Discussion options

You must be logged in to vote

In what form are your files? If they are Blob objects:

import { zipSync } from 'fflate';

const downloadZip = async () => {
  // As long as these are Blob objects it is fine
  const image1Blob = new Blob([pngData], { type: 'image/png' });
  const image2Blob = new Blob([jpgData], { type: 'image/jpeg' });
  const zip = zipSync({
    // Ultimately the input should be Uint8Array
    // If you don't have Blob objects, find some other way to make the data Uint8Array
    'image1.png': new Uint8Array(await image1Blob.arrayBuffer()),
    'image2.jpeg': new Uint8Array(await image2Blob.arrayBuffer())
  }, { level: 0 });
  // Level 0 disables compression
  
  // Temporary URL that contains blob
  const 

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@sannysoni123
Comment options

@101arrowz
Comment options

@sannysoni123
Comment options

Answer selected by sannysoni123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #84 on September 03, 2021 06:41.