Docs: Clarify undici module vs fetch in Node
Why install undici if it's included in Node
It would be REALLY useful to explain the differences between undici as a module vs the parts included in Node. Generally I understand that the fetch API is included in Node from v20 or so - and that the undici version included in Node can be determined from the value process.versions.undici - but beyond this not much.
It would also be very useful to have something that explains when you should install undici as a module, rather than just using the Node internal, e.g.
- you want to use a specific version of
undici - you require APIs that aren't available in Node, i.e.
ProxyAgent?, and presumably others?
Please include something along these lines in your docs (preferably somewhere near the top, or at least link it there).
I believe it can be good to outline possible situations where is better to use undici's APIs rather than fetch directly.
Would you like to send a PR addressing that?
I believe it can be good to outline possible situations where is better to use
undici's APIs rather thanfetchdirectly.Would you like to send a PR addressing that?
I'm afraid I do not posses the intimate knowledge of undici required to write authoritative documentation on its intended use. I was rather hoping someone on this project could do that.
I've checked the Node docs and there's very little in there! Only a passing mention to undici in the output of require('node:process').versions, and a section introducing the fetch API that quickly starts to mention importing undici components even though there's no mention of having to install the module first 😞
We can help you go through it to develop it, that's not an issue (in case you are interested)
I'm interested in working on this and created a draft PR. Not sure if we want to add more or edit the main node docs as well but happy to iterate based on feedback!