1. Is there any built in function available?
fileSize is a built-in function that gives you size.
2. If not what is the best way to calculate the size?
This method is good enough to calculate the size of a folder / directory.
3. Is it good to use cache to store already calculated file size?
Yes, you can save it in the cache.
source share