Socket
Socket
Sign inDemoInstall

cacheable-lookup

Package Overview
Dependencies
0
Maintainers
2
Versions
34
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc