From fa156c37337040d04098a1bded780f7ac7cad6a0 Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Sun, 21 Aug 2022 08:44:36 -0500 Subject: [PATCH] Use getZipFileReader on readFileBlob --- helpers/scanner/scan.mjs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/helpers/scanner/scan.mjs b/helpers/scanner/scan.mjs index f337e30..7b23ce9 100644 --- a/helpers/scanner/scan.mjs +++ b/helpers/scanner/scan.mjs @@ -143,19 +143,13 @@ export class AppScan { async readFileBlob ( FileInstance ) { return new Promise( async ( resolve, reject ) => { - // Check if file is a Blob, typically in the Browser - // otherwise convert it to a Blob, like in Node - // Both Browser and Node have Blob - // Node/Our File Polyfill references .arrayBuffer as a property - // Browser currently references .arrayBuffer as an async method - const FileBlob = FileInstance instanceof Blob ? FileInstance : new Blob( FileInstance.arrayBuffer ) - // console.log( 'FileBlob', FileBlob ) + console.log( 'FileInstance', FileInstance ) - const fileReader = new zip.BlobReader( FileBlob ) + const binaryReader = this.getZipFileReader( FileInstance ) //new zip.BlobReader( FileBlob ) // https://gildas-lormeau.github.io/zip.js/core-api.html#zip-reading - const zipReader = new zip.ZipReader( fileReader ) + const zipReader = new zip.ZipReader( binaryReader ) zipReader .getEntries()