mirror of
https://github.com/mempool/mempool.git
synced 2025-01-07 22:19:21 +01:00
17 lines
319 B
TypeScript
17 lines
319 B
TypeScript
|
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();
|