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

cacheable-lookup

Package Overview
Dependencies
Maintainers
2
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cacheable-lookup - npm Package Compare versions

Comparing version 4.2.0 to 4.2.1

2

package.json
{
"name": "cacheable-lookup",
"version": "4.2.0",
"version": "4.2.1",
"description": "A cacheable dns.lookup(…) that respects the TTL",

@@ -5,0 +5,0 @@ "engines": {

@@ -89,3 +89,3 @@ # cacheable-lookup

The time how long it needs to remember failed queries (TTL in seconds).
The time how long it needs to remember queries that threw `ENOTFOUND` (TTL in seconds).

@@ -92,0 +92,0 @@ **Note**: This option is independent, `options.maxTtl` does not affect this.

'use strict';
const {watchFile} = require('fs');
const {readFile} = require('fs').promises;
const {readFile, stat} = require('fs').promises;
const {isIP} = require('net');

@@ -20,2 +19,23 @@

// TODO: Remove this when https://github.com/nodejs/node/issues/33096 gets fixed
const watchFile = (path, callback, onError) => {
let previousTime = null;
const interval = setInterval(async () => {
try {
const {mtimeMs} = await stat(path);
if (previousTime !== null && mtimeMs !== previousTime) {
callback(mtimeMs, previousTime);
}
previousTime = mtimeMs;
} catch (error) {
clearInterval(interval);
onError(error);
}
}, 1000 * 60).unref();
};
class HostsResolver {

@@ -42,2 +62,4 @@ constructor(customHostsPath = hostsPath) {

}
}, error => {
this._error = error;
});

@@ -44,0 +66,0 @@

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