node-ebics-client/lib/keymanagers/fsKeysStorage.js
2018-06-15 09:33:41 +03:00

27 lines
382 B
JavaScript

'use strict';
const fs = require('fs');
module.exports = (pathToFile) => {
const path = pathToFile;
return {
read() {
return fs.readFileSync(path, { encoding: 'utf8' });
},
save(data) {
fs.writeFileSync(path, data, { encoding: 'utf8' });
return this;
},
hasData() {
if (fs.existsSync(path))
return this.read() !== '';
return false;
},
};
};