3

I've got some strings that I need to compress server-side in C#, then decompress client-side in JavaScript. What can I use to accomplish this?

1 Answer 1

7

Assuming you're fetching this data over HTTP, is there any reason you can't do this at the HTTP level? (See this article for information about HTTP compression.)

That way you shouldn't need to do anything on the client side, apart from making sure that the request includes the appropriate Accept-Encoding header. Depending on your server, you may be able to just tweak some server settings to get the compression automatically on that side too...

To be honest, it's worth breaking out WireShark to check exactly what's going up and down the wire already. It's just possible you've already got compression without knowing it :)

Sign up to request clarification or add additional context in comments.

2 Comments

Just check the headers with something like Firebug. The server response is cleary marked as gzipped if it is, and it has no Content-Lenght because of that (on the fly compression). Firebug will show you the actual bytes transferred.
Could also use Fiddler [fiddler2.com] instead of WireShark. Imho, it is easier to use, if you need HTTP-level data only and can make your connection go through a proxy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.