node-nk-base
Advanced tools
Comparing version 2.0.9 to 2.1.0
92
index.js
@@ -17,4 +17,5 @@ function NKB(basefile) { | ||
const fs = require('fs'); | ||
var bt = fs.readFileSync(basefile, 'utf-8'); | ||
var lastBaseFileUpdate; | ||
let bt = fs.readFileSync(basefile, 'utf-8'); | ||
let lastBaseFileUpdate; | ||
let changed = false; | ||
@@ -56,21 +57,3 @@ fs.writeFileSync(basefile, bt, 'utf-8'); | ||
function wb(newtx) { | ||
try { | ||
fs.writeFileSync(basefile, newtx, 'utf-8'); | ||
lastBaseFileUpdate = fs.statSync(basefile).mtimeMs; | ||
fs.writeFileSync(basefile + '.reserve', newtx, 'utf-8'); | ||
return true; | ||
} catch { | ||
console.error(`node-nk-base writeBase: can't write file with this path(${basefile})!`); | ||
return null; | ||
} | ||
} | ||
this.bool = '±'; | ||
@@ -269,3 +252,5 @@ this.num = 'ň'; | ||
if(wb(bt)) return true; else return null; | ||
changed = true; | ||
return true; | ||
@@ -321,4 +306,6 @@ } | ||
if(wb(bt)) return true; else return null; | ||
changed = true; | ||
return true; | ||
} | ||
@@ -373,3 +360,5 @@ | ||
if(wb(bt)) return true; else return null; | ||
changed = true; | ||
return true; | ||
@@ -466,4 +455,6 @@ } | ||
if(wb(bt)) return true; else return false; | ||
changed = true; | ||
return true; | ||
} | ||
@@ -489,4 +480,6 @@ | ||
if(wb(bt)) return true; else return null; | ||
changed = true; | ||
return true; | ||
} | ||
@@ -583,10 +576,8 @@ | ||
newbt += `` + bt.substring(se, bt.length); | ||
bt = newbt; | ||
newbt = null; | ||
if(!err) { | ||
changed = true; | ||
if(wb(bt)) return true; else return null; | ||
} else return null; | ||
return true; | ||
@@ -623,4 +614,6 @@ } | ||
if(wb(bt)) return true; else return null; | ||
changed = true; | ||
return true; | ||
} | ||
@@ -785,4 +778,6 @@ | ||
if(wb(bt)) return true; else return null; | ||
changed = true; | ||
return true; | ||
} | ||
@@ -825,3 +820,5 @@ | ||
if(wb(bt)) return true; else return null; | ||
changed = true; | ||
return true; | ||
@@ -1130,8 +1127,35 @@ } | ||
} | ||
new Promise(async () => { | ||
for(;;) { | ||
console.log(`node-nk-base started on file "${basefile}"`); | ||
await new Promise((resolve) => setTimeout(resolve, 1000)); | ||
if(changed) { | ||
changed = false; | ||
try { | ||
fs.writeFileSync(basefile, newtx, 'utf-8'); | ||
lastBaseFileUpdate = fs.statSync(basefile).mtimeMs; | ||
fs.writeFileSync(basefile + '.reserve', newtx, 'utf-8'); | ||
} catch { | ||
console.error(`node-nk-base writeBase: can't write file with this path(${basefile})!`); | ||
} | ||
} | ||
} | ||
}); | ||
console.log(`node-nk-base started on file "${basefile}"`); | ||
} | ||
module.exports = NKB; |
{ | ||
"name": "node-nk-base", | ||
"version": "2.0.9", | ||
"version": "2.1.0", | ||
"description": "database for nodejs by NK", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
37570
770
0