Axios多部分表单数据

In my backend Node.js code, I'm using Axios TypeScript code to upload a document. But I'm facing an issue while using form data. Can anyone help me here? From Axios documentation:

  // `data` is the data to be sent as the request body
  // Only applicable for request methods 'PUT', 'POST', and 'PATCH'
  // When no `transformRequest` is set, must be of one of the following types:
  // - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams
  // - Browser only: FormData, File, Blob
  // - Node only: Stream, Buffer

When I try to use FormData I get this error ReferenceError: FormData is not defined. So not sure how to use form data in TypeScript and pass to Axios.

我不能使用来自Node.js的表单数据吗?

评论