How to use the pako/lib/deflate.deflate function in pako

To help you get started, we’ve selected a few pako examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github VisualComposer / builder / public / editor / services / dataProcessor / service.js View on Github external
appServerRequest (args) {
    let url = window.vcvAjaxUrl
    args = Object.assign({
      'vcv-nonce': window.vcvNonce,
      'vcv-source-id': window.vcvSourceID
    }, args)

    if (env('VCV_JS_SAVE_ZIP')) {
      let binaryString = deflate(JSON.stringify(args), { to: 'string' })
      let encodedString = base64.encode(binaryString)
      args = {
        'vcv-zip': encodedString
      }
    }

    return this.http(url).post(args)
  },
  appAdminServerRequest (args) {
github VisualComposer / builder / public / components / wpVcSettings / statusCheck.js View on Github external
export const checkStatus = () => {
  if (!$checkContainer.length) {
    return
  }
  const binaryString = deflate(JSON.stringify({
    'vcv-action': 'settings:systemStatus:checkPayloadProcessing:adminNonce',
    'vcv-nonce': window.vcvNonce,
    'vcv-check-payload': generateFakeData()
  }), { to: 'string' })

  const encodedString = base64.encode(binaryString)
  const data = {
    'vcv-zip': encodedString
  }

  $.ajax(window.vcvAdminAjaxUrl, {
    type: 'POST',
    dataType: 'json',
    async: true,
    data: data
  }).done((json) => {
github VisualComposer / builder / public / editor / services / utils / service.js View on Github external
if (request.status >= 200 && request.status < 400) {
        successCallback(request)
      } else {
        if (typeof failureCallback === 'function') {
          failureCallback(request)
        }
      }
    }
    request.onerror = (response) => {
      if (typeof failureCallback === 'function') {
        failureCallback(request)
      }
    }

    if (env('VCV_JS_SAVE_ZIP')) {
      let binaryString = deflate(JSON.stringify(data), { to: 'string' })
      let encodedString = base64.encode(binaryString)
      data = {
        'vcv-zip': encodedString
      }
    }

    request.send(window.jQuery.param(data))

    return request
  },
  normalizeHtml (data) {