Last active
April 3, 2026 23:04
-
-
Save nrbrd/324cee008b5931b79ddc to your computer and use it in GitHub Desktop.
Download and open ePubjs with Cordova/Phonegap on Android - http://goo.gl/iW26Dt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| download: function(book, uri){ | |
| window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSystem) { | |
| fileSystem.root.getFile("Book/" + book.file_name, { | |
| create : true, | |
| exclusive : false | |
| }, function(fileEntry) { | |
| localPath = fileEntry.toURL(); | |
| ft = new FileTransfer(); | |
| ft.download(uri, localPath, function(entry) { | |
| getBook(entry); | |
| }, erroCallback); | |
| },erroCallback); | |
| fileSystem.root.getFile("Book/.nomedia" , { | |
| create : true, | |
| exclusive : false | |
| }, | |
| function(fileEntry) { | |
| }, | |
| erroCallback); | |
| }, erroCallback); | |
| }, | |
| getBook: function(path){ | |
| window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSystem) { | |
| fileSystem.root.getDirectory("Book/BookFolder", {create: true, exclusive:false}, function(fileEntry){ | |
| zip.unzip(path.toURL(), fileEntry.toURL(), function(){path.remove(); readBook(fileEntry.toURL());}); | |
| }); | |
| }); | |
| }, | |
| readBook: function(path){ | |
| //open the epub with the given path | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment