octet-stream / form-data

Spec-compliant FormData implementation for Node.js
https://www.npmjs.com/package/formdata-node
MIT License
142 stars 17 forks source link

Deprecation warning when creating a FormData instance #36

Closed negezor closed 3 years ago

negezor commented 3 years ago
import { FormData } from 'formdata-node';

const fd = new FormData();

In console

(node:9605) DeprecationWarning: FormData#[Symbol.asyncIterator]() method is non-standard and will be removed from this package in the next major release (4.x). Use https://npmjs.com/form-data-encoder package to serilize FormData.
package version
formdata-node 3.5.2
octet-stream commented 3 years ago

What's wrong about this? It only warns you that you'll need another package to perform form-data encoding in case if your HTTP client does not have built in support for spec compliant FormData.

jimmywarting commented 3 years ago

I guess it would be better with a one time warning only if you are using the method.

negezor commented 3 years ago

@octet-stream I am using this module in my library for Node.js. Any time a FormData instance is created, a DeprecationWarning is thrown. Although I am using form-data-encoder, this warning is annoying for end developers.

octet-stream commented 3 years ago

That's make sense. This is probably happens because I'm trying to initialize Readable stream for FormData#stream property. Maybe I need to move it to getter and cache it 🤔

negezor commented 3 years ago

I think this would be the right solution.

octet-stream commented 3 years ago

Try latest version: https://github.com/octet-stream/form-data/releases/tag/v3.5.3