import { Injectable } from '@angular/core' ; import * as JSZip from 'jszip' ; import { OverwolfService } from '../overwolf.service' ; @ Injectable ( ) export class SimpleIOService { constructor ( private readonly ow ) { } public async zipAppLogFolder ( appName ) { const dirListingResult = await this . ow . listFilesInAppDirectory ( 'Firestone' ) ; const path = dirListingResult . path ; const files = dirListingResult . data . filter ( ( d ) => d . type === 'file' ) . map ( ( file ) => file . name ) ; const fileContents = await Promise . all ( files . map ( ( file ) => ( { fileName : file , contents : this . ow . readTextFile ( path + '/' + file ) , } ) ) ) ; const jszip = new JSZip . default ( ) ; fileContents . forEach ( ( file ) => jszip . file ( file . fileName , file . contents ) ) ; const content = await jszip . generateAsync ( { type : 'blob' , compression : 'DEFLATE' , compressionOptions : { level : 9 , } , } ) ; return content ; } }