pierrec / node-lz4

LZ4 fast compression algorithm for NodeJS
MIT License
438 stars 98 forks source link

compress file from web client, error with compressHC #34

Closed raullucero closed 8 years ago

raullucero commented 8 years ago

I'm trying to compress files from the web client, i have an error when i tried to compress the file with the compressHC metho.

Let you my code

reader.onloadend = (function(theFile) {
    return function(e) {
      console.log(e.target.result)
      var input = new Buffer(e.target.result)    

      var output = LZ4.encode(input, { highCompression: true });
      console.log(output);
      console.log(output.length);
    }; 
})(file)
reader.readAsArrayBuffer(file)

the error is "this.compress is not a function"

pierrec commented 8 years ago

Hello,

Currently, I havent had time to implement lz4 high compression in javascript, so currently it actually defaults to the standard fast compression algorithm. For some reason, it does not for you.

Could you try disabling high compression first and seeing if it works?

raullucero commented 8 years ago

yeah, it works so then i'll be using the compress by default configuration, thanks pierrec