These are just my notes for a file sharing solution. I've created a react component in my ionic Typescript app to test the force download plugin for capacitor and it works on the browser. I have not tested in native with Android Studio yet. Will do next.

import React, { useCallback, useState, useEffect, useRef } from "react";

//https://www.npmjs.com/package/@byteowls/capacitor-filesharer
import { FileSharer } from "@byteowls/capacitor-filesharer";

const MyTest: React.FC = () => {
  function downloadFile() {
    FileSharer.share({
      filename: "test.jpg",
      contentType: "image/jpg",
      // If you want to save base64:
      base64Data: "",
      // If you want to save a file from a path:
      path: "test.jpg",
    })
      .then(() => {
        // do something
      })
      .catch((error) => {
        console.error("File sharing failed", error.message);
      });
  }

  return <>{downloadFile()}</>;
};

export default MyTest;


 

 

https://www.npmjs.com/package/@byteowls/capacitor-filesharer