()
| 24 | private awaitingResolve: ((val: ChunkReadResult | Promise<ChunkReadResult>) => void) | null = null |
| 25 | |
| 26 | public async read (): Promise<ChunkReadResult> { |
| 27 | if (this.done && this.chunks.length === 0) { |
| 28 | return { done: true, value: undefined } |
| 29 | } |
| 30 | if (this.chunks.length === 0) { |
| 31 | return await new Promise<ChunkReadResult>((resolve) => { |
| 32 | this.awaitingResolve = resolve |
| 33 | }) |
| 34 | } |
| 35 | return { done: false, value: this.chunks.shift() } |
| 36 | } |
| 37 | |
| 38 | public push (blob: Blob): void { |
| 39 | if (this.done) { |
no test coverage detected