diff --git a/lib/Dicer.js b/lib/Dicer.js index 9d580cb..4c21db7 100644 --- a/lib/Dicer.js +++ b/lib/Dicer.js @@ -203,7 +203,9 @@ Dicer.prototype._oninfo = function(isMatch, data, start, end) { if (this._isPreamble) this._isPreamble = false; else { - ++this._parts; + // Only the non-empty part will be counted. + // Because the onEnd function is only called in the onHeader event. + (end > start) && ++this._parts; this._part.on('end', function() { if (--self._parts === 0) { if (self._finished) {