JavaScript implements Web page decompression and view zip file _javascript Tips

Source: Internet
Author: User

Web front-end decompression Zip compression package

What is the use of the Web front-end to extract Zip files:

Only consider the standard browser, the server as long as the transmission of compressed packets to the client, saving bandwidth, and save the transmission time, sounds like very strong said;

If the front end of the code a lot, but also include the first mate of the picture, then you can JS and CSS and JPG and PNG and other types of data through the server packaged into a zip to the browser, the browser is responsible for decompression, CSS practical dynamic generation inserted into the DOM, JS also used Globaleval direct execution, JPG or PNG various picture files from blob to image, directly inserted into the browser;

HTML5 supports reading BLOBs (binary large objects, file files also inherit blobs) and translates into picture streams or text flow or other streaming formats, which is why browsers can read "Application/zip" files;

To extract the zip file in the browser, you need to introduce four JS, because Unziparchive.js relies on zip.js, mime-type.js and Jquery.js, the test demo is as follows:

<! DOCTYPE html>  

Unzioarichivejs is your own package, if you have any questions, please feedback in time

Extract the full demo of Zip compression package

<! DOCTYPE html>  

But browser compatibility is a big problem;

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.