Friday, 2 June 2017

The difference between node.js ws permessagedeflate zlip decompression and that of pako?

I have a node.js ws websocket that receives compressed data.

The docs are very shallow about the inflate mechanism but from reading through source files it is clearly in-built and should be activated automatically depending on the type of received data.

However, when attaching ws.on('message',function(data){}) event it returns a < Buffer >

Since I knew that those streams have been previously inflated with Pako, I have tried to installed it, and it actually worked using the following code:

pako.inflate(data, { to: 'string' })

From what I understand both modules use zlib decompression but ws module somehow misses it.

Could someone give a reasonable explanation or at least a hypothesis why?



via Anonymous

No comments:

Post a Comment