Gzip a File in the Browser Before Uploading

Gzip in browser before uploading to S3

          const enc = new TextEncoder(), dec = new TextDecoder(); // Here you lot tin can pass your html as a string and process information technology const buf = enc.encode('How-do-you-do globe!'); // The default compression method is gzip // Increasing mem may increase functioning at the cost of retentiveness // The mem ranges from 0 to 12, where iv is the default const compressed = fflate.compressSync(buf, { level: 6, mem: 8 }); // When you need to decompress: const decompressed = fflate.decompressSync(compressed); const origText = dec.decode(decompressed); console.log(origText); // Hello world!        
          url: the url to upload your compress information data: the compressed data role upload(url, data) { return axios({ method: "put", headers: { 'content-type': 'text/html', 'content-encoding' : 'gzip' }, url, data, }) }        

nesbittdoncepre.blogspot.com

Source: https://simranraj8.medium.com/gzip-in-browser-before-uploading-to-s3-c171ba706e1f

0 Response to "Gzip a File in the Browser Before Uploading"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel