UNPKG

@petro-kushchak/homebridge-homepod-radio

Version:

Homebridge accessory for streaming radio to Homepod Mini and Apple TV

20 lines 495 B
import { promises as fs } from 'fs'; export class Storage { filePath; constructor(filePath) { this.filePath = filePath; } async write(data) { await fs.writeFile(this.filePath, JSON.stringify(data), 'utf8'); } async read() { try { const data = await fs.readFile(this.filePath); return JSON.parse(data.toString()); } catch (err) { return null; } } } //# sourceMappingURL=storage.js.map