function collectBuffers(input, opts) {
  return new Promise((res, rej) => {
    const result = [];
    const spaceErr = new Error(`Error, input stream maxed out allowed space ${opts.max}`);
    const timeoutErr = new Error(`Timeout after ${opts.timeout}ms of reading input stream`);
    spaceErr.code = 1;
    timeoutErr.code = 2;
    const self = new stream.Writable({
      write(v, _e, c) {
        if (opts.max && (this.bytesBuffered = (this.bytesBuffered || 0) + v.length) > opts.max) c(spaceErr);
        else c(null, result.push(v));
      },
    });
    let timeout;
    if (opts.timeout) timeout = setTimeout(() => self.destroy(timeoutErr), opts.timeout);
    stream.pipeline(input, self, err => {
      clearTimeout(timeout);
      err ? rej(err) : res(result);
    });
  });
}
**UNRECOMMENDED**: Synchronously collect chunks into an array of buffers
@param {NodeJS.ReadableStream} input Readable input stream
@param {object} [opts] Optional configuration options
@param {number} [opts.max] Maximum number of bytes to be buffered, reject if larger
@param {number} [opts.timeout] Timeout to fully read, buffer and return, otherwise reject