(blob: Blob)
| 36 | } |
| 37 | |
| 38 | public push (blob: Blob): void { |
| 39 | if (this.done) { |
| 40 | console.warn('ChunkReader: push into closed stream') |
| 41 | // close just in case someone is waiting for a chunk |
| 42 | if (this.awaitingResolve !== null) { |
| 43 | this.awaitingResolve({ done: true, value: undefined }) |
| 44 | } |
| 45 | return |
| 46 | } |
| 47 | |
| 48 | this.chunks.push(blob) |
| 49 | if (this.awaitingResolve !== null) { |
| 50 | this.awaitingResolve(this.read()) |
| 51 | this.awaitingResolve = null |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | public close (): void { |
| 56 | this.done = true |