UNPKG

@remote.it/core

Version:

Core remote.it JavasScript/TypeScript library

18 lines (15 loc) 322 B
import { File } from './File' export class JSONFile<T> extends File { /** * Return the JSON parsed contents of the file. */ read(): T { return JSON.parse(this.content) } /** * Write the JSON contents to the file. */ write(content: T) { this.content = JSON.stringify(content, null, 2) } }