| 63 | } |
| 64 | |
| 65 | public put(data: Uint32Array, start: number, end: number): void { |
| 66 | if (this._aborted || !this._dec) { |
| 67 | return; |
| 68 | } |
| 69 | this._size += end - start; |
| 70 | if (this._size > this._opts.sixelSizeLimit) { |
| 71 | console.warn(`SIXEL: too much data, aborting`); |
| 72 | this._aborted = true; |
| 73 | this._dec.release(); |
| 74 | return; |
| 75 | } |
| 76 | try { |
| 77 | this._dec.decode(data, start, end); |
| 78 | } catch (e) { |
| 79 | console.warn(`SIXEL: error while decoding image - ${e}`); |
| 80 | this._aborted = true; |
| 81 | this._dec.release(); |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | public unhook(success: boolean): boolean | Promise<boolean> { |
| 86 | if (this._aborted || !success || !this._dec) { |