audiobookshelf/server/objects/files/EBookFile.js

34 lines
699 B
JavaScript
Raw Normal View History

2022-03-09 02:31:44 +01:00
const FileMetadata = require('../metadata/FileMetadata')
class EBookFile {
constructor(file) {
this.ino = null
this.metadata = null
this.ebookFormat = null
this.addedAt = null
this.updatedAt = null
2022-03-09 02:31:44 +01:00
if (file) {
this.construct(file)
}
}
construct(file) {
this.ino = file.ino
this.metadata = new FileMetadata(file)
this.ebookFormat = file.ebookFormat
this.addedAt = file.addedAt
this.updatedAt = file.updatedAt
2022-03-09 02:31:44 +01:00
}
toJSON() {
return {
ino: this.ino,
metadata: this.metadata.toJSON(),
ebookFormat: this.ebookFormat,
addedAt: this.addedAt,
updatedAt: this.updatedAt
2022-03-09 02:31:44 +01:00
}
}
}
module.exports = EBookFile