parser.pause() #65

wants to merge 8 commits into

5 participants


Added support for parser.pause() with the following semantics:

After a parser.pause(), no events should be emitted before the next parser.resume(), even if parser.write() is invoked.

Needed to slightly modify:

  • parser.write(): to detect pauses and buffer the chunk if parser is paused.
  • parser.resume(): to resume all the pending buffers that were written while paused.
  • parser.pause(): to set the pausing state, to be detected in parser.write().

Added test test/pause.js that takes a large xml chunk, breaks it in pieces and:

  • asserts that no event is emitted while paused.
  • asserts that the order of all events is as expected.

Documented parser.pause in README.


Found this problem when .end() occurs while it's paused, will have to come back, sorry.

@pgte pgte closed this Mar 23, 2012
@pgte pgte reopened this Mar 23, 2012
@pgte pgte referenced this pull request in substack/node-trumpet Sep 15, 2012

composing #6


I'd like to pull this in, but it doesn't apply cleanly. would you mind rebasing onto the current master, and squash down to one or two commits?

@andrewrk andrewrk referenced this pull request Jul 22, 2013

parser.pause() #107


Can we get this pull request accepted? I could really use parser.pause()


Anything happening with this? It would make my life complete.


That's a bit humorous. parser.pause() = life complete. Sorry. Had to state the obviously cheesy. :neckbeard:


+1 for this feature !


Superseded by #107

@isaacs isaacs closed this Apr 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment