& #65279; computation of gzip compression (deflate) and inflate implemented by javascript

Source: Internet
Author: User
I accidentally saw an article today and found this interesting stuff. First, and then use it again. Source Address: javascriptdeflate source address javascriptinflate source address Sudone archive: javascriptdeflate archive address javascriptinflate archive address usage method 1 (decompression): 1. Use Server

I accidentally saw an article today and found this interesting stuff.

First, and then use it again.

Source Address:
Javascript deflate Source Address
Javascript inflate Source Address

Sudone archive:
Javascript deflate archival address
Javascript inflate archival address

Method 1 (Extract):

1. Use the server program to send dataCompressionIt is best to add base64 encoding so that ascii text can be obtained, so that it can be easily mixed with other source code of the web page.
2. decompress the data obtained from the client using the js function for subsequent use.
3. Usage angle: Mainly mild encryption: It is troublesome for ordinary people to solve these things.
4. Note: 1. This method is different from automatic compression on the server. The source code can be easily seen on the client. 2. If the compression is not for encryption, the content should preferably be larger than 1000 bytes, otherwise it will not be able to achieve any compression effect.


Method 2 (compression ):

1. First, compress the data using js functions, and then convert the data into base64 code.
2. It's all nonsense to upload the program to the server.
3. Usage: compresses the forms and data submitted by the client and then uploads the data to the server, because the current server-side compression technology does not support upload compression, therefore, this technology has practical value, and can also achieve lightweight encryption of uploaded data.

Note: I have not tested the performance of these functions, so in terms of performance, you need to test the performance before using it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.