SynTex Filesystem
An intelligent file system for reading and writing files.
Use This In Your Code
let Logger = require('syntex-logger'),
FileSystem = require('syntex-filesystem');
let logger = new Logger({ pluginName : 'Demo Plugin' }, { language : 'us', levels : { debug : false }, time : true });
logger.setLogDirectory('/var/demo_plugin/logs');
let files = new FileSystem({ logger, baseDirectory : '/var/demo_plugin/' }, { initDirectories : ['example', 'logs'], enableCache : false });
var filePath = '/example/demo.json',
exampleContent = { a : 1, b : 2 };
files.writeFile(filePath, exampleContent).then((response) => {
logger.debug(response);
files.readFile(filePath).then((data) => {
logger.debug(data);
}).catch((error) => {
if(error != null)
{
logger.err(error);
}
});
});
Troubleshooting
Report
us your Issues
Join
our Discord Server