mirror of
https://github.com/node-ebics/node-ebics-client.git
synced 2025-08-14 03:35:36 +00:00
client and order optimization
This commit is contained in:
27
lib/storages/fsKeysStorage.js
Normal file
27
lib/storages/fsKeysStorage.js
Normal file
@@ -0,0 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
module.exports = (pathToFile) => {
|
||||
const path = pathToFile;
|
||||
|
||||
return {
|
||||
read() {
|
||||
if (!fs.existsSync(path))
|
||||
return null;
|
||||
return fs.readFileSync(path, { encoding: 'utf8' });
|
||||
},
|
||||
|
||||
write(data) {
|
||||
fs.writeFileSync(path, data, { encoding: 'utf8' });
|
||||
return this;
|
||||
},
|
||||
|
||||
hasData() {
|
||||
if (fs.existsSync(path))
|
||||
return this.read() !== '';
|
||||
|
||||
return false;
|
||||
},
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user