admin管理员组

文章数量:1315826

I am trying to get LZ4 depression to work client-side in pure JavaScript.

I found this JavaScript library but it's meant to be used with Node.js. Within the same repository I found a library which can in theory be used in the browser. The problem is that such library expects still Node.js buffers which again I don't have since I'm not using Node.js and all of this is happening client side (I logged a bug here to try and get a hold of some pointers for how to use it).

I then looked for a porting of Node.js buffers and I found this repository. The problem is that when I use it I get this error in both Chrome and Firefox:

TypeError: this is not a typed array

I logged this bug report for this. I feel like bining those two libraries I am not too far from achieving lz4 depression in pure JavaScript but having never worked before with ArrayBuffer, Uint8Array and Node.js I am struggling to connect the dots.

My question: Has anyone successfully managed to depress LZ4 in pure JavaScript? Any advice or pointers? Thanks in advance.

I am trying to get LZ4 depression to work client-side in pure JavaScript.

I found this JavaScript library but it's meant to be used with Node.js. Within the same repository I found a library which can in theory be used in the browser. The problem is that such library expects still Node.js buffers which again I don't have since I'm not using Node.js and all of this is happening client side (I logged a bug here to try and get a hold of some pointers for how to use it).

I then looked for a porting of Node.js buffers and I found this repository. The problem is that when I use it I get this error in both Chrome and Firefox:

TypeError: this is not a typed array

I logged this bug report for this. I feel like bining those two libraries I am not too far from achieving lz4 depression in pure JavaScript but having never worked before with ArrayBuffer, Uint8Array and Node.js I am struggling to connect the dots.

My question: Has anyone successfully managed to depress LZ4 in pure JavaScript? Any advice or pointers? Thanks in advance.

Share Improve this question edited Dec 13, 2013 at 16:13 Mike Vella 10.6k15 gold badges61 silver badges91 bronze badges asked Dec 13, 2013 at 15:47 TarelliTarelli 6347 silver badges18 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

I will provide an IDEA not a solution, you can try this repository

https://code.google./p/lz4/

it has a pure c implementation of LZ4

you can pile that with clang to llvm bitcode

and when you have that, you use this https://github./kripken/emscripten

to get javascript out of the llvm bitcode

its like c to javascript pilation, it maybe sound crazy but if you look at what they already achieved... i dont know it could actually work.

take a look here they ported lots of things to javascript with this tool for example this one: https://github./kripken/lzma.js

本文标签: Using lz4 compression in javascript without NodejsStack Overflow