File tree Expand file tree Collapse file tree
extensions/ql-vscode/src/common Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,6 +25,10 @@ export function excludeDirectories(entries: ZipEntry[]): ZipEntry[] {
2525 return entries . filter ( ( entry ) => ! / \/ $ / . test ( entry . fileName ) ) ;
2626}
2727
28+ function calculateTotalUncompressedByteSize ( entries : ZipEntry [ ] ) : number {
29+ return entries . reduce ( ( total , entry ) => total + entry . uncompressedSize , 0 ) ;
30+ }
31+
2832export function readZipEntries ( zipFile : ZipFile ) : Promise < ZipEntry [ ] > {
2933 return new Promise ( ( resolve , reject ) => {
3034 const files : ZipEntry [ ] = [ ] ;
@@ -191,10 +195,7 @@ export async function unzipToDirectory(
191195 let filesExtracted = 0 ;
192196 const totalFiles = entries . length ;
193197 let bytesExtracted = 0 ;
194- const totalBytes = entries . reduce (
195- ( total , entry ) => total + entry . uncompressedSize ,
196- 0 ,
197- ) ;
198+ const totalBytes = calculateTotalUncompressedByteSize ( entries ) ;
198199
199200 const reportProgress = ( ) => {
200201 progress ?.( {
You can’t perform that action at this time.
0 commit comments