🙏 How to send `FormData` with `File` in node environment?
Describe the feature
In node environment (v20), I want to upload an image to OSS by posting FormData, I've tried several solutions, such as using form-data deps, but still failed.
It works well in web envrionment.
Additional information
- [ ] Would you be willing to help implement this feature?
https://www.npmjs.com/package/form-data
use Native api just like fetch
ofetch.native('your_url', { method: 'POST', body: formData })
Node.js supports built-in FormData since v18 powered by undici.
You can simply pass it as body and ofetch works with it.
PS: Using ofetch() and ofetch.native() should be equal. only difference is that ofetch.native returns full response object.
If you had further questions, please feel free to open a discussion with some of your code.