Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vates/cached-dns.lookup

Package Overview
Dependencies
Maintainers
7
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vates/cached-dns.lookup

Cached implementation of dns.lookup

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
7
Created
Source

@vates/cached-dns.lookup

Package Version License PackagePhobia Node compatibility

Cached implementation of dns.lookup

Install

Installation of the npm package:

> npm install --save @vates/cached-dns.lookup

Usage

Node does not cache queries to dns.lookup, which can leads application doing a lot of connections to have perf issues and to saturate Node threads pool.

This library attemps to mitigate these problems by providing a version of this function with a version short cache, applied on both errors and results.

Limitation: verbatim: false option is not supported.

I has exactly the same API as the native method and can be used directly:

import { createCachedLookup } from '@vates/cached-dns.lookup'

const lookup = createCachedLookup()

lookup('example.net', { all: true, family: 0 }, (error, result) => {
  if (error != null) {
    return console.warn(error)
  }
  console.log(result)
})

Or it can be used to replace the native implementation and speed up the whole app:

// assign our cached implementation to dns.lookup
const restore = createCachedLookup().patchGlobal()

// to restore the previous implementation
restore()

Contributions

Contributions are very welcomed, either on the documentation or on the code.

You may:

  • report any issue you've encountered;
  • fork and create a pull request.

License

ISC © Vates SAS

Keywords

FAQs

Package last updated on 28 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc