In WinRT there is no FileInfo
class, only a StorageFile
class.
How can I get the size of a file using the StorageFile
class?
The GetFileSize function retrieves the uncompressed size of a file.
To get a file's size in C++ first open the file and seek it to the end. tell() will tell us the current position of the stream, which will be the number of bytes in the file.
Open My Computer or Windows Explorer. Make Windows display file properties by clicking View at the top of the window, and then selecting Details. Once this action is completed, Explorer displays all your files, their sizes, type, and last modified date.
So here you go:
storageFile.getBasicPropertiesAsync().then(
function (basicProperties) {
var size = basicProperties.size;
}
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With