Capacitor’s Device Plugin in versions <= 6 included this in the getInfo
method - Device Capacitor Plugin API | Capacitor Documentation. In v7 it was removed due to it requiring a Privacy Manifest for iOS - feat(device)!: remove disk size related information by jcesarmobile · Pull Request #2251 · ionic-team/capacitor-plugins · GitHub
You could look at the code and re-implement in your own plugin.