4

Actually I trying to upload large text and pdf files. I want to compress file chunks in browser only. So i can encrypt and send these lite chunk through ajax smoothly without hanging browser. I am seeking help related to file chunk compression. And at server side easily can decompress using java library. Can anyone suggest me best way to do it ? It should be in client side and inside browser(IE11,Google Chrome).

Jeet
  • 185
  • 1
  • 2
  • 10

2 Answers2

5

Gzip is a popular method for compressing data before sending it over the web.

There are many javascript libraries, such as https://github.com/beatgammit/gzip-js which will compress a string/byte array for you.

Java has Gzip functionality built-in through java.util.zip.GZIPInputStream;; a simple google search will make it easy to learn how to use it.

Ameo
  • 2,307
  • 5
  • 21
  • 33
  • thanks but I have to use in production so i have some restrictions on GPL license so. If you can help me with client side with other library please. I m okay with server side GZIP. – Jeet Mar 16 '16 at 17:53
0

There are several JS libs that can help you with that, if the zip format is acceptable. JSZip is one of the most well known ones.

OliverRadini
  • 6,238
  • 1
  • 21
  • 46
lucasnadalutti
  • 5,818
  • 1
  • 28
  • 48
  • thanks but It's under gpl so I can't use it. If any other suggestions please let me know. – Jeet Mar 16 '16 at 18:01