Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

browser support #968

Closed
ronag opened this issue Aug 16, 2021 · 3 comments
Closed

browser support #968

ronag opened this issue Aug 16, 2021 · 3 comments
Labels
enhancement New feature or request fetch

Comments

@ronag
Copy link
Member

ronag commented Aug 16, 2021

This is just a fun thought that I don't personally plan to spend much time on.

It should be in theory possible to run undici in the browser (especially the fetch parts) if one creates a BrowserClient implementation based on e.g. XMLHTTPRequest. That way we could in theory even act as an alternative to e.g. https://github.com/github/fetch fetch polyfill.

We have implemented some of the web stuff from the spec and there a clear TODOs (examples) with references to spec for the missing parts. There are a few node specific stuff we make use of (e.g. Buffer) but those should be somewhat trivial to either replace or polyfill.

@ronag ronag added the enhancement New feature or request label Aug 16, 2021
@ronag
Copy link
Member Author

ronag commented Aug 16, 2021

@JakeChampion just a friendly ping in case there is any potential room for collaboration with https://github.com/github/fetch.

@ronag ronag added the fetch label Aug 16, 2021
@ronag
Copy link
Member Author

ronag commented Aug 16, 2021

A quick link to our work https://github.com/nodejs/undici/tree/main/lib/fetch

@jimmywarting
Copy link
Contributor

jimmywarting commented Aug 16, 2021

Sounds fun but also pointless, XMLHttpRequest don't have any good streaming support

also you would be importing a browserified version of node:http that includes buffer, readable-stream and many other small sub packages like inherit. that alone is some few 170kb of code the amount code would be large

pretty much all browser ships fetch now days. so what would be the point?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fetch
Projects
None yet
Development

No branches or pull requests

2 participants