Compressing xhtml client side using javascript?
Hi I'm making a word processor app.
Users will be able to edit the document (an xhtml doc) and save. This xhtml doc can become very big (a 50k word doc is 500kb), and posting th开发者_高级运维e xhtml to a server can become slow.
I suppose the right way to do this is to send only the the diff data and patch in server. This can take time to develop and test.
To build the min viable product as fast as possible, I would like to compress the xhtml with javascript client-side, send the compressed file to the server and store it in the db compress.
Eventually I may need to get the xhtml back in ruby, for server processing, but not often.
Is there a way to compress an xhtml using javascript client-side?
Several coders have written compression tools in JavaScript using Huffman coding:
http://rumkin.com/tools/compression/compress_huff.php
http://tom-ash.net/blogs/Programming/huffman_coding.html
http://www.ioyu.com/io/javascript/huffman.asp
Not aware of any way to do client-side compression natively from JavaScript.
精彩评论