Socket
Socket
Sign inDemoInstall

node-persist

Package Overview
Dependencies
Maintainers
3
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-persist - npm Package Compare versions

Comparing version 3.1.3 to 4.0.0

2

package.json
{
"name": "node-persist",
"version": "3.1.3",
"version": "4.0.0",
"description": "Super-easy (and fast) persistent data structures in Node.js, modeled after HTML5 localStorage",

@@ -5,0 +5,0 @@ "main": "./src/node-persist.js",

@@ -48,4 +48,4 @@ /*

const md5 = function (key) {
return crypto.createHash('md5').update(key).digest('hex');
const sha256 = function (key) {
return crypto.createHash('sha256').update(key).digest('hex');
};

@@ -224,3 +224,3 @@

getDatumPath: function (key) {
return path.join(this.options.dir, md5(key));
return path.join(this.options.dir, sha256(key));
},

@@ -258,4 +258,4 @@

//check to see if dir is present
fs.exists(dir, (exists) => {
if (exists) {
fs.access(dir, (accessErr) => {
if (!accessErr) {
return resolve(result);

@@ -279,4 +279,4 @@ } else {

//check to see if dir is present
fs.exists(dir, (exists) => {
if (exists) {
fs.access(dir, (accessErr) => {
if (!accessErr) {
//load data

@@ -408,4 +408,4 @@ fs.readdir(dir, async (err, arr) => {

return new Promise((resolve, reject) => {
fs.exists(file, (exists) => {
if (exists) {
fs.access(file, (accessErr) => {
if (!accessErr) {
this.log(`Removing file:${file}`);

@@ -417,3 +417,3 @@ fs.unlink(file, (err) => {

}
let result = {file: file, removed: !err, existed: exists};
let result = {file: file, removed: !err, existed: !accessErr};
err && this.log(`Failed to remove file:${file} because it doesn't exist anymore.`);

@@ -424,3 +424,3 @@ resolve(result);

this.log(`Not removing file:${file} because it doesn't exist`);
let result = {file: file, removed: false, existed: exists};
let result = {file: file, removed: false, existed: false};
resolve(result);

@@ -427,0 +427,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc