nl_tokens: if there s something in the buffer waiting then process it
pl_tokens: function clearBuffer ( stream , state ) { state . bufferProcessing = true ; var entry = state . bufferedRequest ; if ( stream . _writev && entry && entry . next ) { // Fast case, write everything using _writev() var l = state . bufferedRequestCount ; var buffer = new Array ( l ) ; var holder = state . corkedRequestsFree ; holder . entry = entry ; var count = 0 ; var allBuffers = true ; while ( entry ) { buffer [ count ] = entry ; if ( ! entry . isBuf ) allBuffers = false ; entry = entry . next ; count += 1 ; } buffer . allBuffers = allBuffers ; doWrite ( stream , state , true , state . length , buffer , '' , holder . finish ) ; // doWrite is almost always async, defer these to save a bit of time // as the hot path ends with doWrite state . pendingcb ++ ; state . lastBufferedRequest = null ; if ( holder . next ) { state . corkedRequestsFree = holder . next ; holder . next = null ; } else { state . corkedRequestsFree = new CorkedRequest ( state ) ; } state . bufferedRequestCount = 0 ; } else { // Slow case, write chunks one-by-one while ( entry ) { var chunk = entry . chunk ; var encoding = entry . encoding ; var cb = entry . callback ; var len = state . objectMode ? 1 : chunk . length ; doWrite ( stream , state , false , len , chunk , encoding , cb ) ; entry = entry . next ; state . bufferedRequestCount -- ; // if we didn't call the onwrite immediately, then // it means that we need to wait until it does. // also, that means that the chunk and cb are currently // being processed, so move the buffer counter past them. if ( state . writing ) { break ; } } if ( entry === null ) state . lastBufferedRequest = null ; } state . bufferedRequest = <mask> ; state . bufferProcessing = false ; }