sindresorhus/ky

What's different form r2? โšก๏ธ๐Ÿ‘

antonmedv opened this issue ยท 10 comments

It's an early release. There's no major difference yet, but soon there'll be many useful features which r2 doesn't provide.

From a quick glance at r2, the main benefits of ky are:

  • Built for the browser only. r2 targets Node.js too, which means it has to target the lowest common denominator. node-fetch is missing a lot of functionality.
  • Treats non-200 status codes as errors.
  • Retries failed requests.
  • Timeout support.
  • Instances with custom defaults.
  • Uses functions instead of properties for the body methods. .json() is clearer than .json. See: mikeal/r2#22
  • Better docs.
  • Actively maintained (Although it's early, I do intend to actively maintain it). The last commit of r2 was in May.
  • Many cool things planned for the future ๐Ÿ˜Ž

We'll add a comparison table later on when Ky is more mature.

@sindresorhus r2 is built for browsers too. It uses node-fetch as a polyfill.

@szmarczak You're right. I only read the first part of the text. Updated.

Aside from comparaison table, if you think these differences are better, why not discussing them between library makers and choose one existing one and make it stronger & reliable lib. So that everybody can commit and improve without fearing it gets abandonned next year? Some libs are much older and their makers dont have @sindresorhus exposure, though this lib is heavily inspired by them.

@borisrorsvort I first started this project more than a year ago as an experiment to see how I could reimagine Got if it were built for the browser and based on Fetch. It's solely inspired by Got and Fetch. I only just recently had the time to finish it up and publish it.

It's not clear what libs you're referring to, but if you can share, I can elaborate more. If you mean r2, I had not seen it before it was mentioned here, but it's also clearly not maintained anymore, so trying to contribute to it would not be very productive.


without fearing it gets abandonned next year?

I have 1K+ npm packages and I actively maintain them all. I've been doing open source for many years and I don't see that changing. I'm in for the long haul. I'm supported by the community to work on open source full-time. I created Got in early 2014 and it's still actively maintained. Ky also has another maintainer and hopefully even more additional maintainers in the future. I hope this addresses your concerns.

There is https://github.com/elbywan/wretch for instance .
My comment wasn't in no way intended to question the quality of your work which I deeply respect but more as a general remark about the js ecosystem.

There is elbywan/wretch for instance.

Its overly chainable API would be a dealbreaker for me personally. I don't see anyway they would change that.

My comment wasn't in no way intended to question the quality of your work which I deeply respect but more as a general remark about the js ecosystem.

I did not take it as that :) I just wanted to elaborate on why Ky will not end up being abandoned like a lot of projects in the JS ecosystem, which I totally agree is a big problem.

One of the most significant differences is latest browsers support by default.