node-ebics-client/lib/storages/fsKeysStorage.js

20 lines
315 B
JavaScript
Raw Normal View History

2018-06-15 06:33:41 +00:00
'use strict';
const fs = require('fs');
module.exports = (pathToFile) => {
const path = pathToFile;
return {
read() {
2018-06-20 09:20:03 +00:00
if (!fs.existsSync(path))
return null;
2018-06-15 06:33:41 +00:00
return fs.readFileSync(path, { encoding: 'utf8' });
},
2018-06-20 09:20:03 +00:00
write(data) {
2018-06-15 06:33:41 +00:00
fs.writeFileSync(path, data, { encoding: 'utf8' });
},
};
};