Skip to content
Discussion options

You must be logged in to vote

Got uses Node's default DNS resolution which is dns.lookup() under the hood (via the http/https modules).

For DNS caching, yes, you should use the cacheable-lookup package. You can pass it to Got like this:

import CacheableLookup from 'cacheable-lookup';

const cacheable = new CacheableLookup();

await got('https://example.com', {
	dnsLookup: cacheable.lookup
});

This is definately recommended if you're making many requests to the same hosts, as it can significantly improve performance by avoiding redundant DNS lookups.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sindresorhus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants