code: function createEventEmitterCallback(event, emitter) {
      return function (ex) {
          if (ex) {
              emitter.emit('error', ex);
          } else {
              var args = Array.prototype.slice.call(arguments);
              args[0] = event;
              emitter.emit.apply(emitter, args);
              if (event == 'end') {
                  emitter.removeAllListeners();
              }
          }
      };
  }
docs: Provides a callback function that emits the supplied event type or an error event.