| 486 | } |
| 487 | |
| 488 | unchunk(chunk) { |
| 489 | this._buffer.push(chunk); |
| 490 | this._bytesReceived += chunk.byteLength || chunk.size; |
| 491 | const totalChunks = this._buffer.length; |
| 492 | this.progress = this._bytesReceived / this._size; |
| 493 | if (isNaN(this.progress)) this.progress = 1 |
| 494 | |
| 495 | if (this._bytesReceived < this._size) return; |
| 496 | // we are done |
| 497 | let blob = new Blob(this._buffer, { type: this._mime }); |
| 498 | this._callback({ |
| 499 | name: this._name, |
| 500 | mime: this._mime, |
| 501 | size: this._size, |
| 502 | blob: blob |
| 503 | }); |
| 504 | } |
| 505 | |
| 506 | } |
| 507 | |