I am developing a plugin to track disc usage of folders and file types. I understand you can get the file properties of the active file using this.app.workspace.getActiveFile()
and ending with stat.size
and extension
will get me the size in bytes and file type respectively. Is there some way to get this same information but across many files, or a directory of files?
I am imagining I will have to create a program similar to Linux’s du
(disk usage) command, which I had this previously written in until I realized three flaws in this approach
- I would need
sudo
privileges - I would need to rewrite it in powershell for Windows
- And I would need to figure out some solution for mobile.
I realized using Obsidian’s own API is likely the best route and would appreciate any advice or tips.