()
| 6144 | } |
| 6145 | } |
| 6146 | finish() { |
| 6147 | assert(currentParser === null); |
| 6148 | assert(this.ptr != null); |
| 6149 | assert(!this.paused); |
| 6150 | const { llhttp } = this; |
| 6151 | let ret; |
| 6152 | try { |
| 6153 | currentParser = this; |
| 6154 | ret = llhttp.llhttp_finish(this.ptr); |
| 6155 | } finally { |
| 6156 | currentParser = null; |
| 6157 | } |
| 6158 | if (ret === constants3.ERROR.OK) { |
| 6159 | return null; |
| 6160 | } |
| 6161 | if (ret === constants3.ERROR.PAUSED || ret === constants3.ERROR.PAUSED_UPGRADE) { |
| 6162 | this.paused = true; |
| 6163 | return null; |
| 6164 | } |
| 6165 | return this.createError(ret, EMPTY_BUF); |
| 6166 | } |
| 6167 | createError(ret, data) { |
| 6168 | const { llhttp, contentLength, bytesRead } = this; |
| 6169 | if (contentLength && bytesRead !== parseInt(contentLength, 10)) { |
no test coverage detected