nodejs / node-eps

Node.js Enhancement Proposals for discussion on future API additions/changes to Node core
443 stars 66 forks source link

fetch() #53

Closed puppetmaster3 closed 6 years ago

puppetmaster3 commented 7 years ago

fetch() runs in a browser. And sometimes I port my code to node. But in node, I need to 'polyfill' fetch()

That is an example where I think there should be more parity.

Fishrock123 commented 7 years ago

Could you try looking for an npm module?

There isn't anything special about fetch() that it can't be written in a user module.

puppetmaster3 commented 7 years ago

I do use 3rd party. My point is I should not have to. Another ex: abt() for base64. There should be more parity.

fnky commented 7 years ago

Do you mean atob()? atob, btoa and fetch aren't part of ECMAScript; but part of the WhatWG spec. I agree it would be nice to have it in, just like the WhatWG URL Implementation. Whether it's necessary in node core, I am not so sure.

Read why they turned down atob and btoa in node core.

Fishrock123 commented 7 years ago

@jhabdas how so?

ghost commented 7 years ago

Sorry that was a misfire. Was thinking of import(). My bad.

piranna commented 7 years ago

I think there should be alternatives for the web environment following the W3C APIs to allow easy interoperatibility and reuse of code, but I don't think they should be added to the Node.js core, in fact I think this should be lighten and move things to npm (but that's another discussion). A module that export all the WhatWG APIs so you can use them directly from Node.js would be a really good thing.

bmeck commented 6 years ago

I'm going to close this as the repo is being archived and there is a lack of activity.

My suggestion is to make a PR and/or issue on https://github.com/nodejs/node to discuss this. The TSC has moved towards being more open to PRs as an effort to be more welcoming. Hope it all works out!