code: function toBuffer (options, callback) {
    if (is.object(options)) {
      if (is.bool(options.resolveWithObject)) {
        this.options.resolveWithObject = options.resolveWithObject;
      }
    }
    return this._pipeline(is.fn(options) ? options : callback);
  }
docs: Write output to a Buffer.
  JPEG, PNG, WebP, TIFF and RAW output are supported.
  By default, the format will match the input image, except GIF and SVG input which become PNG output.
  
  `callback`, if present, gets three arguments `(err, data, info)` where:
  - `err` is an error, if any.
  - `data` is the output image data.
  - `info` contains the output image `format`, `size` (bytes), `width`, `height`,
  `channels` and `premultiplied` (indicating if premultiplication was used).
  When using a crop strategy also contains `cropOffsetLeft` and `cropOffsetTop`.
  
  A `Promise` is returned when `callback` is not provided.
  
  @example
  sharp(input)
  .toBuffer((err, data, info) => { ... });
  
  @example
  sharp(input)
  .toBuffer()
  .then(data => { ... })
  .catch(err => { ... });
  
  @example
  sharp(input)
  .toBuffer({ resolveWithObject: true })
  .then(({ data, info }) => { ... })
  .catch(err => { ... });
  
  @param {Object} [options]
  @param {Boolean} [options.resolveWithObject] Resolve the Promise with an Object containing `data` and `info` properties instead of resolving only with `data`.
  @param {Function} [callback]
  @returns {Promise<Buffer>} - when no callback is provided