How to retrieve memory used by application

I want to retrieve memory used by application like storage and cache and store it in variable.
I have tried @capacitor/device but it gives different size for every run. moreover it not near to the memory used by the application.
Can anyone suggest me some method to retrieve the application size after it being installed