How to use the pako.deflateRaw 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 jilieryuyi / wing-binlog / web / lang / zh / vendors / jszip / lib / flate.js View on Github external
exports.compress = function(input, compressionOptions) {
    return pako.deflateRaw(input, {
        level : compressionOptions.level || -1 // default compression
    });
};
exports.uncompress =  function(input) {
github jitsi / jitsi-meet / modules / xmpp / xmpp.js View on Github external
sendLogs: function (data) {
        if(!connection.emuc.focusMucJid)
            return false;

        var deflate = true;

        var content = JSON.stringify(data);
        if (deflate) {
            content = String.fromCharCode.apply(null, Pako.deflateRaw(content));
        }
        content = Base64.encode(content);
        // XEP-0337-ish
        var message = $msg({to: connection.emuc.focusMucJid, type: 'normal'});
        message.c('log', { xmlns: 'urn:xmpp:eventlog',
            id: 'PeerConnectionStats'});
        message.c('message').t(content).up();
        if (deflate) {
            message.c('tag', {name: "deflated", value: "true"}).up();
        }
        message.up();

        connection.send(message);
        return true;
    },
    // Gets the logs from strophe.jingle.
github algenty / grafana-flowcharting / src / utils.js View on Github external
encode(data, encode, deflate, base64) {
    let result = data;
    if (encode) {
      try {
        result = encodeURIComponent(result);
      } catch (e) {
        console.error(e);
        return;
      }
    }

    if (deflate && result.length > 0) {
      try {
        result = this.bytesToString(pako.deflateRaw(result));
      } catch (e) {
        console.error(e);
        return;
      }
    }

    if (base64) {
      try {
        result = btoa(result);
      } catch (e) {
        console.error(e);
        return;
      }
    }
    return result;
  },
github algenty / grafana-flowcharting / dist / utils.js View on Github external
encode: function encode(data, _encode, deflate, base64) {
    if (_encode) {
      try {
        data = encodeURIComponent(data);
      } catch (e) {
        console.error(e);
        return;
      }
    }

    if (deflate && data.length > 0) {
      try {
        data = this.bytesToString(pako.deflateRaw(data));
      } catch (e) {
        console.error(e);
        return;
      }
    }

    if (base64) {
      try {
        data = btoa(data);
      } catch (e) {
        console.error(e);
        return;
      }
    }

    return data;
github Litarvan / pronote-api / src / cipher.js View on Github external
function cipher({ session, string, compress, rsaKey })
{
    if (rsaKey === undefined)
    {
        rsaKey = session.cleAES;
    }

    string = forge.util.encodeUtf8('' + string);

    //let original = string;

    if (compress && !session.disableCompress)
    {
        string = new forge.util.ByteBuffer(string).toHex();
        string = pako.deflateRaw(string, {
            level: 6,
            to: 'string'
        })
    }

    let key = forge.md.md5.create().update(rsaKey.bytes()).digest();
    let iv = session.ivAES.length() ? forge.md.md5.create().update(session.ivAES.bytes()).digest() : new forge.util.ByteBuffer();

    let cipher = forge.cipher.createCipher('AES-CBC', key);
    cipher.start({
        iv: iv
    });
    cipher.update(new forge.util.ByteBuffer(string));

    return cipher.finish() && cipher.output.toHex();
    /*let result = cipher.finish() && cipher.output.toHex();
github calebegg / codewich / src / urls.ts View on Github external
function toUrlKey(code: string) {
  return btoa(deflateRaw(code, {to: 'string'}))
      .replace(/=*$/, '')
      .replace(/\//g, '_')
      .replace(/\+/g, '.');
}
github ukyo / zlib-wasm-without-emscripten-sample / benchmark / bench-1mbtxt.js View on Github external
      fn: () => pako.deflateRaw(source, { chunkSize, level }),
    })
github Two9A / c64clicker / js / thirdparty / jszip / lib / flate.js View on Github external
exports.compress = function(input) {
    return pako.deflateRaw(input);
};
exports.uncompress =  function(input) {
github creationix / wheaty / wheaty.js View on Github external
var deflate = bodec.Binary === Buffer ? function (data) {
  if (bodec.Binary === Buffer) {
    return new Buffer(pako.deflateRaw(new Uint8Array(data)));
  }
} : pako.deflateRaw;