Skip to content

Commit a4f99e6

Browse files
committed
Replace couple require calls with imports
1 parent 55e4481 commit a4f99e6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/v1/internal/ch-node.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import net from 'net';
2020
import tls from 'tls';
2121
import fs from 'fs';
2222
import path from 'path';
23+
import readline from 'readline';
24+
import crypto from 'crypto';
2325
import {EOL} from 'os';
2426
import {NodeBuffer} from './buf';
2527
import {ENCRYPTION_OFF, isEmptyObjectOrNull} from './util';
@@ -61,7 +63,7 @@ function loadFingerprint( serverId, knownHostsPath, cb ) {
6163
return cb(null)
6264
}
6365
let found = false;
64-
require('readline').createInterface({
66+
readline.createInterface({
6567
input: fs.createReadStream(knownHostsPath)
6668
}).on('line', (line) => {
6769
if( !found && line.startsWith( serverId )) {
@@ -180,7 +182,7 @@ const TrustStrategy = {
180182
return;
181183
}
182184

183-
const serverFingerprint = require('crypto').createHash('sha512').update(serverCert.raw).digest("hex");
185+
const serverFingerprint = crypto.createHash('sha512').update(serverCert.raw).digest('hex');
184186
const knownHostsPath = config.knownHostsPath || path.join(userHome(), ".neo4j", "known_hosts");
185187
const serverId = config.url.hostAndPort;
186188

0 commit comments

Comments
 (0)