EPUB: add a method for getting Calibre bookmarks

See https://github.com/johnfactotum/foliate/issues/849
This commit is contained in:
John Factotum authored and GitHub committed 2022-11-04 10:43:30 +00:00
1 parent a11fd9637d
commit bc22699bab
1 file changed
+8
+8
View File
@@ -736,4 +736,12 @@ export class EPUB {
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)
}
}
}