_formatSendMultipleData(type, files, fileOptions = {}) {
    const formData = {};
    const fileIds = {};

    files.forEach((file, index) => {
      let filedata = file.media || file.data || file[type];
      let filename = file.filename || fileOptions.filename;
      let contentType = file.contentType || fileOptions.contentType;

      if (filedata instanceof stream.Stream) {
        if (!filename && filedata.path) {
          const url = URL.parse(path.basename(filedata.path.toString()), true);
          if (url.pathname) {
            filename = qs.unescape(url.pathname);
          }
        }
      } else if (Buffer.isBuffer(filedata)) {
        filename = `filename_${index}`;

        if (!contentType) {
          const filetype = fileType(filedata);

          if (filetype) {
            contentType = filetype.mime;
            const ext = filetype.ext;

            if (ext) {
              filename = `${filename}.${ext}`;
            }
          } else {
            throw new errors.FatalError('Unsupported Buffer file-type');
          }
        }
      } else if (fs.existsSync(filedata)) {
        filedata = fs.createReadStream(filedata);

        if (!filename) {
          filename = path.basename(filedata.path);
        }
      } else {
        fileIds[index] = filedata;
        return;
      }

      filename = filename || `filename_${index}`;
      contentType = contentType || 'application/octet-stream';

      formData[`${type}_${index}`] = {
        value: filedata,
        options: {
          filename,
          contentType,
        },
      };
    });

    return { formData, fileIds };
  }
Format multiple files to be uploaded; handles file paths, streams, and buffers
@param {String} type
@param {Array} files Array of file data objects
@param {Object} fileOptions File options
@param {String} [fileOptions.filename] File name
@param {String} [fileOptions.contentType] Content type (i.e. MIME)
@return {Object} formatted
@return {Object} formatted.formData Form data object with all files
@return {Array} formatted.fileIds Array of fileIds for non-file data
@throws Error if Buffer file type is not supported.
@see https://npmjs.com/package/file-type
@private