Comments (5)
This would be a major semver bump and large rewrite.
from superagent.
👍 for this!
Looking at the dependency graph: https://npmgraph.js.org/[email protected]
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
from superagent.
yeah it would be amazing to have all functionality of superagent (e.g. retrys) on top of undici
from superagent.
Could you maybe create a new brach?
i would expect there to be kind of many breaking changes...
- require at least NodeJS v16.8 (required by undici)
- build things using fetch, FormData, Blob, File, Response, Request
- dropping total support for XHR and only using fetch
- that could mean that it would also work in service workers
- Node runtime could use pretty much the same codebase
- maybe this could be switched to ESM syntax?
- if XHR and http(s) gets replaced with fetch then we also loose progress monitoring
- things like this won't work anymore:
.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...
from superagent.
@jimmywarting this all sounds amazing. we just gave you collab access to the entire @ladjs org.
from superagent.
Related Issues (20)
- request.field('test', 'str') throwing error Failed to execute 'append' on 'FormData': parameter 2 is not of type 'Blob'.
- how to send gzip compressed body superagent
- Does superagent support ALPN for http2 ? HOT 5
- Notice regarding the move from @visionmedia org to @ladjs org HOT 4
- Cookies are sent to domains that are not allowed HOT 1
- [fix] request hangs forever for non-responding servers (default timeout would fix this)
- [fix] Following redirects discards set cookies without explicit domain HOT 5
- [feat] Configuring request header before specifying the method HOT 1
- Unix socket is expected to be encoded with `%2F`
- [fix] seralization error of BigInt does not throw an exception HOT 3
- superagent dependancy package semver latest version is not upgrading for yarn install HOT 2
- [fix] Can't handle socket hangup (pipe)
- [fix] Error: Cannot find module 'node:url' HOT 3
- [proposal] Only using node testing tools HOT 3
- Please upgrade to latest, formidable@v3! Check these notes: https://bit.ly/2ZEqIau HOT 8
- The agent() set default behavior is nonsensical
- [fix] TypeError: hexoid is not a function in Formidable.js when using Webpack + TypeScript HOT 1
- [fix] TypeError: req.setNoDelay is not a function HOT 1
- [bug] Setting cookies does not take effect
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from superagent.