What is pako and its uses

Article directory

The role of pako

Gzip compression pushed by ws can reduce a large amount of transmission data and reduce transmission data consumption, but it needs to be decompressed after receiving the data.
After decompressing, you can use pako

use

npm install pako
  function (msg) {
    
    
    let reader = new FileReader()
    reader.readAsBinaryString(msg) // blob
    reader.onload = function () {
    
    
      result = JSON.parse(pako.inflate(reader.result, {
    
     to: 'string' }))
      // 打印出返回的数据
      console.log(result)
    }
  }

Guess you like

Origin blog.csdn.net/mantou_riji/article/details/135001065