-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathtestLib.js
26 lines (23 loc) · 810 Bytes
/
testLib.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const utils = require("./src/utils.js");
const fs = require('fs');
const ini = require('ini');
const path = require("path");
const CONFIG_FILE = path.join(__dirname, "config.ini");
if(fs.existsSync(CONFIG_FILE)) {
fs.readFile(CONFIG_FILE, 'utf-8', (err, data) => {
if (err) throw err;
config = ini.parse(data);
console.log(config);
console.log("Searching for the best hash lib.");
utils.testLibs().then((lib) => {
config.hashlib = lib;
fs.writeFile(CONFIG_FILE, ini.stringify(config), (err) => {
if(err) throw err;
console.log("Config file saved");
});
console.log("Using " + config.hashlib + " for hashing");
});
});
} else {
console.log("Config file not found");
};