ky-universal alternatives and similar modules
Based on the "HTTP" category.
Alternatively, view ky-universal alternatives based on common mentions on social networks and blogs.
-
superagent
Ajax for Node.js and browsers (JS HTTP client). Maintained for @forwardemail, @ladjs, @spamscanner, @breejs, @cabinjs, and @lassjs. -
rocky
DISCONTINUED. Full-featured, middleware-oriented, programmatic HTTP and WebSocket proxy for node.js (deprecated) -
http-fake-backend
DISCONTINUED. Build a fake backend by providing the content of JSON files or JavaScript objects through configurable routes. -
Bearer
DISCONTINUED. Call any API and monitor requests with the Bearer API client for Node.js client Bearer. -
Pluto HTTP Client
HTTP client for NodeJS. Inspired in the Java JAX-RS spec so you can expect excellence, versatility and extensibility.
CodeRabbit: AI Code Reviews for Developers

* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of ky-universal or a related project?
README
ky-universal
Use Ky in both Node.js and browsers
Ky is made for browsers, but this package makes it possible to use it in Node.js too, by polyfilling most of the required browser APIs using node-fetch
and abort-controller
.
This package can be useful for:
- Isomorphic code
- Web apps (React, Vue.js, etc.) that use server-side rendering (SSR)
- Testing browser libraries using a Node.js test runner
Note: Before opening an issue, make sure it's an issue with Ky and not its polyfills. Generally, if something works in the browser, but not in Node.js, it's an issue with node-fetch
or abort-controller
.
Keep in mind that Ky targets modern browsers when used in the browser. For older browsers, you will need to transpile and use a fetch
polyfill.
If you only target Node.js, I would strongly recommend using Got instead.
Install
npm install ky ky-universal
Note that you also need to install ky
.
Usage
import ky from 'ky-universal';
const parsed = await ky('https://httpbin.org/json').json();
// …
ReadableStream
support
For ReadableStream
support, also install web-streams-polyfill
:
$ npm install web-streams-polyfill
You can then use it normally:
import ky from 'ky-universal';
const {body} = await ky('https://httpbin.org/bytes/16');
const {value} = await body.getReader().read();
const result = new TextDecoder('utf-8').decode(value);
// …
API
The API is exactly the same as the Ky API, including the named exports.
FAQ
How do I use this with a web app (React, Vue.js, etc.) that uses server-side rendering (SSR)?
Use it like you would use Ky:
import ky from 'ky-universal';
const parsed = await ky('https://httpbin.org/json').json();
// …
Webpack will ensure the polyfills are only included and used when the app is rendered on the server-side.
How do I test a browser library that uses Ky in AVA?
Put the following in package.json:
{
"ava": {
"require": [
"ky-universal"
]
}
}
The library that uses Ky will now just work in AVA tests.
clone()
hangs with a large response in Node - What should I do?
Streams in Node.js have a smaller internal buffer size (16 kB, aka highWaterMark
) than browsers (>1 MB, not consistent across browsers). When using Ky, the default highWaterMark
is set to 10 MB, so you shouldn't encounter many issues related to that.
However, you can specify a custom highWaterMark
if needed:
import ky from 'ky-universal';
const response = await ky('https://example.com', {
// 20 MB
highWaterMark: 1000 * 1000 * 20
});
const data = await response.clone().buffer();