]> git.proxmox.com Git - mirror_novnc.git/blob - core/inflator.js
Fix: IE11 Numpad5 compatibility when numlock off
[mirror_novnc.git] / core / inflator.js
1 import { inflateInit, inflate, inflateReset } from "../vendor/pako/lib/zlib/inflate.js";
2 import ZStream from "../vendor/pako/lib/zlib/zstream.js";
3
4 Inflate.prototype = {
5 inflate: function (data, flush, expected) {
6 this.strm.input = data;
7 this.strm.avail_in = this.strm.input.length;
8 this.strm.next_in = 0;
9 this.strm.next_out = 0;
10
11 // resize our output buffer if it's too small
12 // (we could just use multiple chunks, but that would cause an extra
13 // allocation each time to flatten the chunks)
14 if (expected > this.chunkSize) {
15 this.chunkSize = expected;
16 this.strm.output = new Uint8Array(this.chunkSize);
17 }
18
19 this.strm.avail_out = this.chunkSize;
20
21 inflate(this.strm, flush);
22
23 return new Uint8Array(this.strm.output.buffer, 0, this.strm.next_out);
24 },
25
26 reset: function () {
27 inflateReset(this.strm);
28 }
29 };
30
31 export default function Inflate() {
32 this.strm = new ZStream();
33 this.chunkSize = 1024 * 10 * 10;
34 this.strm.output = new Uint8Array(this.chunkSize);
35 this.windowBits = 5;
36
37 inflateInit(this.strm, this.windowBits);
38 };