(controller)
| 127 | } |
| 128 | |
| 129 | start(controller) { |
| 130 | this.stream = createReadStream(__filename); |
| 131 | this.stream.on('data', (chunk) => { |
| 132 | controller.enqueue(chunk.toString()); |
| 133 | }); |
| 134 | this.stream.once('end', () => { |
| 135 | if (!this.cancelCalled) |
| 136 | controller.close(); |
| 137 | }); |
| 138 | this.stream.once('error', (error) => { |
| 139 | controller.error(error); |
| 140 | }); |
| 141 | } |
| 142 | |
| 143 | cancel() { |
| 144 | this.cancelCalled = true; |