Test node js app to load a zip file.
This commit is contained in:
@@ -3,7 +3,7 @@ var JSZip = require('jszip');
|
|||||||
let zip = new JSZip()
|
let zip = new JSZip()
|
||||||
|
|
||||||
new JSZip.external.Promise((resolve, reject)=>{
|
new JSZip.external.Promise((resolve, reject)=>{
|
||||||
fs.readFile('mythical_man_month__the__essays_on_software_engineering__anniversary_edition.zip',
|
fs.readFile('test/mythical_man_month__the__essays_on_software_engineering__anniversary_edition.zip',
|
||||||
(err, data)=>{
|
(err, data)=>{
|
||||||
if (err){
|
if (err){
|
||||||
reject(err);
|
reject(err);
|
||||||
@@ -13,10 +13,15 @@ new JSZip.external.Promise((resolve, reject)=>{
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
.then((data)=>{
|
.then((data)=>{
|
||||||
return JSZip.loadAsync(data)
|
return JSZip.loadAsync(data, {
|
||||||
|
checkCRC32: true
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.then((zip)=>{
|
.then((zip)=>{
|
||||||
console.log(zip)
|
console.log(zip)
|
||||||
|
zip.folder('EPUB').forEach((fileName, _)=>{
|
||||||
|
console.log(`${fileName}`)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.catch((reason)=>{
|
.catch((reason)=>{
|
||||||
console.log(`Error: ${reason}`)
|
console.log(`Error: ${reason}`)
|
||||||
|
|||||||
Reference in New Issue
Block a user