[Exploration] JS/alchemy/C ++ for online web 7z Decompression

Source: Internet
Author: User

A lab project a few months ago: Online Decoding of Web 7z compression. However, the latest and various new technologies are constantly emerging. In a short time, this estimate will go out again, so I will share it with you.

Test: http://www.etherdream.com/LZMA/HTML/Demo.html

  

  

Since the epoch of alchemy, the previously despised Flash has become supreme. We can compile C/C ++ into avm2 VM commands and run them in flash. Flash has such a high installation rate, which gives us the opportunity to implement highly intensive computing on the web, so as to get rid of the inefficiency of As and Js. As an old C and C ++ algorithm, almost every classic algorithm is released as the original version, and then transplanted to other languages.

  

The core algorithm of 7z compression is lzma. The compression ratio is higher than that of traditional zip and RAR files. He is an open-source project. through alchemy, we can easily compile our own decoder. Then we can implement lzma decoding on the web.

  

The lzma plug-in requires two files: lzma.jsand lzma.swf. The latter is the decoder.

  

After being imported to lzma.js, you must wait until the decoder is ready for use. The lzma.swf is loaded successfully. You can use setlistener to specify the ready event to load the compressed file. For more information about the call, see the demo.
  
Call the $ lzma. Load (URL, charset) method to download and decode the specified compressed package. Charset can specify the character encoding of text files, such as UTF-8 and gb2312. If it is a binary file, specify the charset as base64 and return base64-encoded text.
  
Of course, the. Z format file used in this example is not a traditional 7z format document, but a simple format implemented by myself, which is used to save the basic parameters of the compressed package. Try to compress your file into. Z format and download the lzma compression program. C source code is included. Run the following command in cmd:Lzma.exe FileIt can be compressed. The default value is the maximum compression ratio, which requires MB of idle memory.
  
  
Not long agoFlash11Released, whereSupport Using lzma to compress SWF files. In the future, when Flash 11 is popular, we can use the built-in functions to implement a more efficient lzma decoding solution. Please do your best.

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.