mirror of
https://github.com/hexahigh/nodejs-hash-antivirus.git
synced 2025-12-11 20:05:07 +01:00
36 lines
1.1 KiB
JavaScript
36 lines
1.1 KiB
JavaScript
import promptSync from 'prompt-sync';
|
|
import * as fs from 'fs';
|
|
import * as http from 'http';
|
|
import * as https from 'https';
|
|
|
|
|
|
const prompt = promptSync({ sigint: true });
|
|
|
|
console.log("This will update the database.")
|
|
console.log("Do you wish to proceed? Y/N")
|
|
const useragree = prompt("");
|
|
if (useragree == "Y") {
|
|
console.log("Deleting old files")
|
|
console.log("Downloading new files")
|
|
//download first database
|
|
const db69 = fs.createWriteStream("h-db.txt");
|
|
const request = https.get("https://hexahigh.github.io/cdn/Text/h-db.txt", function(response) {
|
|
response.pipe(db69);
|
|
|
|
// after download completed close filestream
|
|
db69.on("finish", () => {
|
|
db69.close();
|
|
});
|
|
});
|
|
const dbmain = fs.createWriteStream("db.txt");
|
|
const request2 = https.get("https://hexahigh.github.io/cdn/Text/db.txt", function(response) {
|
|
response.pipe(dbmain);
|
|
|
|
// after download completed close filestream
|
|
dbmain.on("finish", () => {
|
|
dbmain.close();
|
|
});
|
|
});
|
|
} else {
|
|
console.log("Exiting")
|
|
} |