testing out reading pages straight from a cbz file
This commit is contained in:
parent
5d20759dcc
commit
291b1e411f
53 changed files with 10269 additions and 0 deletions
34
lib/zip.js/tests/test10.js
Executable file
34
lib/zip.js/tests/test10.js
Executable file
|
@ -0,0 +1,34 @@
|
|||
var URL = "lorem_store.zip";
|
||||
|
||||
var zipFs = new zip.fs.FS();
|
||||
|
||||
function onerror(message) {
|
||||
console.error(message);
|
||||
}
|
||||
|
||||
function zipImportedZip(callback) {
|
||||
var directory = zipFs.root.addDirectory("import");
|
||||
directory.importHttpContent(URL, false, function() {
|
||||
zipFs.exportBlob(callback);
|
||||
}, onerror);
|
||||
}
|
||||
|
||||
function unzipBlob(blob, callback) {
|
||||
zipFs.importBlob(blob, function() {
|
||||
var directory = zipFs.root.getChildByName("import");
|
||||
var firstEntry = directory.children[0];
|
||||
firstEntry.getText(callback);
|
||||
}, onerror);
|
||||
}
|
||||
|
||||
function logText(text) {
|
||||
console.log(text);
|
||||
console.log("--------------");
|
||||
}
|
||||
|
||||
zip.workerScriptsPath = "../";
|
||||
zipImportedZip(function(zippedBlob) {
|
||||
unzipBlob(zippedBlob, function(unzippedText) {
|
||||
logText(unzippedText);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue