Test node js app to load a zip file.

This commit is contained in:
Vahagn Khachatryan
2018-12-07 15:59:03 +00:00
parent 4fa4328740
commit c579ee72c9

View File

@@ -3,7 +3,7 @@ var JSZip = require('jszip');
let zip = new JSZip()
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)=>{
if (err){
reject(err);
@@ -13,10 +13,15 @@ new JSZip.external.Promise((resolve, reject)=>{
})
})
.then((data)=>{
return JSZip.loadAsync(data)
return JSZip.loadAsync(data, {
checkCRC32: true
})
})
.then((zip)=>{
console.log(zip)
zip.folder('EPUB').forEach((fileName, _)=>{
console.log(`${fileName}`)
})
})
.catch((reason)=>{
console.log(`Error: ${reason}`)