(opts = {})
| 13 | |
| 14 | class Parser extends Transform { |
| 15 | constructor(opts = {}) { |
| 16 | super({ ...{ readableObjectMode: true }, ...opts, encoding: null }); |
| 17 | this.api = transform({ |
| 18 | on_skip: (err, chunk) => { |
| 19 | this.emit("skip", err, chunk); |
| 20 | }, |
| 21 | ...opts, |
| 22 | }); |
| 23 | // Backward compatibility |
| 24 | this.state = this.api.state; |
| 25 | this.options = this.api.options; |
| 26 | this.info = this.api.info; |
| 27 | } |
| 28 | // Implementation of `Transform._transform` |
| 29 | _transform(buf, _, callback) { |
| 30 | if (this.state.stop === true) { |
nothing calls this directly
no test coverage detected