mirror of
https://github.com/iptv-org/iptv
synced 2025-12-18 03:17:14 -05:00
Update scripts
This commit is contained in:
31
scripts/core/file.ts
Normal file
31
scripts/core/file.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
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()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user