xmppo / node-expat

libexpat XML SAX parser binding for node.js
https://github.com/xmppo/node-expat
MIT License
385 stars 97 forks source link

Stop() or Pause() emit "parser suspended" error then close ? #212

Open williamsdyyz opened 3 years ago

williamsdyyz commented 3 years ago

I'm trying to understand how to control backpressure.

It looks like I should be able to pause the parser while I write data to a db and then resume after the operation is complete, but calling Stop or Pause (same thing?) immediately throws an error and closes the stream.

I've looked at issue https://github.com/astro/node-expat/issues/200 and am calling resume on the next tick, but it never gets as far as the resume call.

What am I missing here?