Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

syntex-filesystem

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

syntex-filesystem - npm Package Compare versions

Comparing version 1.0.2-b9 to 1.0.2

24

.eslintrc.json
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 13,
"sourceType": "module"
},
"rules": {
}
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 13,
"sourceType": "module"
},
"rules": {
}
}

@@ -9,2 +9,5 @@ const fs = require('fs'), path = require('path');

{
this.running = [];
this.query = {};
this.logger = platform.logger;

@@ -54,5 +57,5 @@

{
for(const i in directories)
for(const directory of directories)
{
var absPath = path.join(this.basePath, directories[i]);
var absPath = path.join(this.basePath, directory);

@@ -91,3 +94,10 @@ if(!fs.existsSync(absPath))

{
cache[filePath] = JSON.stringify(file);
if(path.parse(filePath).ext == '.json')
{
cache[filePath] = JSON.stringify(file);
}
else
{
cache[filePath] = file;
}
}

@@ -101,3 +111,3 @@

reject();
reject(e);
}

@@ -111,3 +121,3 @@ }

{
reject();
reject(error);
}

@@ -141,23 +151,43 @@ else

{
if(path.parse(filePath).ext == '.json')
if(!this.running.includes(filePath))
{
data = JSON.stringify(data, null, '\t');
}
this.running.push(filePath);
fs.writeFile(filePath, data, (error) => {
if(!error)
if(path.parse(filePath).ext == '.json')
{
if(this.enableCache)
data = JSON.stringify(data, null, '\t');
}
fs.writeFile(filePath, data, (error) => {
if(!error)
{
cache[filePath] = JSON.stringify(JSON.parse(data));
if(this.enableCache)
{
if(path.parse(filePath).ext == '.json')
{
cache[filePath] = JSON.stringify(JSON.parse(data));
}
else
{
cache[filePath] = data;
}
}
}
}
else
{
this.logger.log('error', 'bridge', 'Bridge', '[' + path.parse(filePath).base + '] %update_error%!', error);
}
else
{
this.logger.log('error', 'bridge', 'Bridge', '[' + path.parse(filePath).base + '] %update_error%!', error);
}
resolve({ success : error == null, changed : true });
});
this.running.splice(this.running.indexOf(filePath), 1);
resolve({ success : error == null, changed : true });
delete this.query[this._runQuery(filePath)];
});
}
else
{
this._addQuery({ filePath, data, resolve });
}
}

@@ -214,20 +244,12 @@ else

{
var fileArray = [];
var fileArray = {};
for(const i in files)
for(const file of files)
{
if(fs.statSync(path.join(filePath, files[i])).isFile())
if(fs.statSync(path.join(filePath, file)).isFile())
{
try
{
var obj = JSON.parse(fs.readFileSync(path.join(filePath, files[i])).toString());
this.readFile(path.join(filePath, file)).then((content) => {
obj.id = path.parse(files[i]).name;
fileArray.push(obj);
}
catch(e)
{
this.logger.log('error', 'bridge', 'Bridge', '[' + path.parse(files[i]).base + '] %parse_error%!', e);
}
fileArray[file] = content;
});
}

@@ -253,5 +275,9 @@ }

{
if(this.enableCache && cache[filePath] != null && cache[filePath] == JSON.stringify(data))
if(this.enableCache && cache[filePath] != null)
{
return false;
if((path.parse(filePath).ext == '.json' && cache[filePath] == JSON.stringify(data))
|| (path.parse(filePath).ext != '.json' && cache[filePath] == data))
{
return false;
}
}

@@ -261,2 +287,29 @@

}
_addQuery(query)
{
var id = 0, keys = Object.keys(this.query);
if(keys.length > 0)
{
id = parseInt(keys[keys.length - 1]) + 1;
}
this.query[id] = query;
}
_runQuery(filePath)
{
for(const id in this.query)
{
const file = this.query[id];
if(file.filePath == filePath)
{
this.writeFile(file.filePath, file.data).then((response) => file.resolve(response));
return id;
}
}
}
}
{
"name": "syntex-filesystem",
"version": "1.0.2-b9",
"version": "1.0.2",
"description": "A Basic File System",

@@ -12,3 +12,3 @@ "main": "main.js",

"dependencies": {
"syntex-logger": "1.0.8-b21"
"syntex-logger": "1.0.8"
},

@@ -15,0 +15,0 @@ "keywords": [

@@ -34,3 +34,9 @@ # SynTex Filesystem

}).catch(() => {}));
}).catch((error) => {
if(error != null)
{
logger.err(error);
}
});
});

@@ -37,0 +43,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