mempool/backend/src/api/disk-cache.ts

17 lines
319 B
TypeScript
Raw Normal View History

2019-07-21 16:59:47 +02:00
import * as fs from 'fs';
class DiskCache {
static FILE_NAME = './cache.json';
constructor() { }
saveData(dataBlob: string) {
fs.writeFileSync(DiskCache.FILE_NAME, dataBlob, 'utf8');
}
loadData(): string {
return fs.readFileSync(DiskCache.FILE_NAME, 'utf8');
}
}
export default new DiskCache();