docs: function consumeStream(stream, callback) {
      var chunks = [];
      stream.on("data", onData);
      stream.on("end", onEnd);
      stream.on("error", onError);
      function onData(chunk) {
          chunks.push(chunk);
      }
      function onEnd() {
          cleanup();
          callback(null, chunks.join(""));
      }
      function onError(err) {
          cleanup();
          callback(err);
      }
      function cleanup() {
          stream.removeListener("data", onData);
          stream.removeListener("end", onEnd);
          stream.removeListener("error", onError);
      }
  }