@remote.it/core
Version:
Core remote.it JavasScript/TypeScript library
29 lines (24 loc) • 566 B
text/typescript
import ini from 'ini'
import debug from 'debug'
import { File } from './File'
const d = debug('remoteit:SystemdUnitFile')
export class SystemdUnitFile<T> extends File {
constructor(public location: string) {
super(location)
}
/**
* Return the JavaScript object representation of the
* XML file.
*/
read(): T {
d('reading unit file')
return ini.decode(this.content) as T
}
/**
* Write the contents as XML to the file.
*/
write(content: T) {
d('writing unit file', content)
this.content = ini.encode(content)
}
}