GithubHelp home page GithubHelp logo

Comments (5)

titanism avatar titanism commented on August 16, 2024

This would be a major semver bump and large rewrite.

from superagent.

jimmywarting avatar jimmywarting commented on August 16, 2024

👍 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.

titanism avatar titanism commented on August 16, 2024

yeah it would be amazing to have all functionality of superagent (e.g. retrys) on top of undici

from superagent.

jimmywarting avatar jimmywarting commented on August 16, 2024

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.

titanism avatar titanism commented on August 16, 2024

@jimmywarting this all sounds amazing. we just gave you collab access to the entire @ladjs org.

from superagent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.