Richienb / cross-formdata

Cross-platform FormData support.
MIT License
1 stars 0 forks source link

Hi #30

Open jimmywarting opened 3 years ago

jimmywarting commented 3 years ago

imagine seeing you using my formdata polyfill :) i was looking at others dependency graph

quite old polyfill i made long ago. i was looking at your cross formdata package.json and saw that you use either formdata-node or formdata-polyfill depending on the env

i was thinking, now that when nodejs have implemented a Blob class, maybe i can make my polyfill cross platform independent as well.

Richienb commented 3 years ago

Whilst Node.js has indeed implemented Blob, it is still missing Blob#stream which is coming with whatwg streams.

jimmywarting commented 3 years ago

Yea, i miss .stream() and whatwg too, even if it's just partially implemented with a async iterator to begin with. Don't really need it to be a node or whatwg stream at first.

Just so i can do for await (chunk of blob) {} or readable.from(iterator)

jimmywarting commented 3 years ago

how good/bad would it be to patch node's blob prototype with async slicing generator method that yields uint8arrays if it dose not exist?

Richienb commented 3 years ago

If you're going to patch a global, it'll need to be a spec-compliant polyfill in order to not interfere with other code that could be using it.