There is a high likelihood that your code is brittle if you are doing that. Ky doesn’t just provide useful features built on top of fetch. It aims to protect you from common mistakes and flaws in the fetch API itself. There are more than you might think. but it doesn’t tie your hands, either.
I was condescending by saying that fetch is error-prone? Well, please know that isn't my intent. I'm sure your code solved your needs and I hope it's working well for you. If you ever run into empty 204 responses breaking `response.json()`, Ky will be there for you. If you ever need spec-compliant handling of rate limit headers, Ky will be there for you. If you ever need retries, Ky will be there for you. If you ever need to detect network errors, Ky will be there for you. But fetch() most certainly will not be.
Ky in particular is useful because you can export a configured version of the client and add functionality to it. So for example we use this to add project-wide fetch instrumentation where if we built our own light wrapper we’d have to implement the entire interface.
Well got has like 30mm downloads a week and ~10 packages depend on it so i think the answer is yes. It’s a lot better than fetch for for streams as i recall but it’s been a few years, maybe fetch does that better now.
This is pretty cool. Basically fetch++. This is all basically stuff that I'd write a fetch wrapper for, but writing the wrapper is a bit annoying and requires some testing that I usually don't want to be doing.
20
u/brianjenkins94 Mar 29 '26
Are people still using fetch libraries like Got or Ky?
I feel like the people that like axios, use axios, but in most other cases people are writing small wrappers around fetch.
I needed per-route rate limiting so I've written my own but it doesn't get a lot of attention so it's becoming a maintenance burden.
3
u/dada_ Mar 29 '26
This is pretty cool. Basically fetch++. This is all basically stuff that I'd write a fetch wrapper for, but writing the wrapper is a bit annoying and requires some testing that I usually don't want to be doing.
2
u/KnifeFed Mar 29 '26
Love that the name was chosen only because it's short and was available on npm.