https://i.stack.imgur.com/3aMyx.png[
async FileZip() {
const code = await fetch("./assets/input.txt")
var blob = await downloadZip([code]).blob()
console.log(blob);
function blobToBase64(blob: Blob): Observable<string> {
return new Observable<string>(observer => {
const reader = new FileReader();
reader.onerror = observer.error;
reader.onabort = observer.error;
reader.onload = () => observer.next(reader.result as string);
reader.onloadend = observer.complete;
FileSharer.share({
filename: "input.zip",
base64Data: //base64datawillbehere ,
contentType: 'application/zip'
});
reader.readAsDataURL(blob);
})
I am brand new to the world of Ionic and App Development. I've successfully compressed a text file into a zip blob file using client-zip library. After utilizing downloadZip(), I obtained a zip blob file similar to this example. Now, my goal is to share this file as a zip file using Capacitor Filesharer. However, it appears that in order to use this Filesharer plugin, I need to convert the blob zip file into base64 data. Could someone provide guidance on how to achieve this? Is it even possible? Please excuse any ignorance in my question, as I'm still learning the ropes of JavaScript.