Search code examples
javascriptjquerybzip2

How to decompress bzip2 data in javascript/jquery?


I have data coming from the API in the bzip2 compressed format. How do i decompress it to string in client side (jquery/js) ?


Solution

  • If client and server are designed to handle the application/x-bzip2 you don't have a lot of work to do. If you need to decompress raw streams you can try these libraries

    https://github.com/antimatter15/bzip2.js
    

    or

    https://github.com/kirilloid/bzip2-js
    

    If you're using npm you could look at

    https://www.npmjs.com/package/bzip2