mirror of
https://github.com/iptv-org/iptv.git
synced 2024-09-06 00:02:24 +02:00
32 lines
523 B
TypeScript
32 lines
523 B
TypeScript
import * as path from 'path'
|
|
|
|
export class File {
|
|
filepath: string
|
|
content: string
|
|
|
|
constructor(filepath: string, content?: string) {
|
|
this.filepath = filepath
|
|
this.content = content || ''
|
|
}
|
|
|
|
getFilename() {
|
|
return path.parse(this.filepath).name
|
|
}
|
|
|
|
dirname() {
|
|
return path.dirname(this.filepath)
|
|
}
|
|
|
|
basename() {
|
|
return path.basename(this.filepath)
|
|
}
|
|
|
|
append(data: string) {
|
|
this.content = this.content + data
|
|
}
|
|
|
|
extension() {
|
|
return this.filepath.split('.').pop()
|
|
}
|
|
}
|