Open titanism opened 1 year ago
This would be a major semver bump and large rewrite.
👍 for this!
Looking at the dependency graph: https://npmgraph.js.org/?q=superagent@8.1.2
i see things like formidable
and form-data
it would be nice to replace them with undici or NodeJS FormData stuff.
parsing formdata could be as simple as using Response/Request.formData()
all doe you get a FormData
back along with File
instances that are real web stuff
yeah it would be amazing to have all functionality of superagent (e.g. retrys) on top of undici
Could you maybe create a new brach?
i would expect there to be kind of many breaking changes...
.on('request', function () {
this.xhr.responseType = 'arraybuffer';
})
it's going to be a Request
instead or a Request-like object so that it can be modified before initiating a fetch call so cache and other can be modified.
I could expect blob/files could be used on the backend as well along with FormData
NodeJS just recently introduced const blob = await fs.openAsBlob(path, { type })
but there is no sync method, and it only works in NodeJS v20+
to solve this problem then fetch-blob
could be used instead. but it's ESM-only
so loading it would be hard unless this pkg dose not also becomes ESM enabled.
another approch would be to import fetch-blob
async using import()
then attach()
would kind of have to queue up all those path -> Blob conversions.
or we would have to read the files content sync and create a Blob in memory...
@jimmywarting this all sounds amazing. we just gave you collab access to the entire @ladjs org.
We'd like to switch to use undici instead of
http
andhttps
packages. The performance difference is staggering and it would makesuperagent
one of the only userland wrappers that use it under the hood.