EPUB: add a method for getting Calibre bookmarks

See https://github.com/johnfactotum/foliate/issues/849
This commit is contained in:
John Factotum
2022-11-04 10:43:30 +00:00
committed by GitHub
parent a11fd9637d
commit bc22699bab
+8
View File
@@ -736,4 +736,12 @@ export class EPUB {
isExternal(uri) { isExternal(uri) {
return isExternal(uri) return isExternal(uri)
} }
async getCalibreBookmarks() {
const txt = await this.loadText('META-INF/calibre_bookmarks.txt')
const magic = 'encoding=json+base64:'
if (txt?.startsWith(magic)) {
const json = atob(txt.slice(magic.length))
return JSON.parse(json)
}
}
} }