Filip Němeček 6/2/2020

How to get file size using FileManager + formatting

Read Original

This article provides a practical guide for Swift developers on how to get a file's size from its URL using FileManager's attributesOfItem method. It explains how to extract the size in bytes and then format it into a human-readable string (e.g., "24.4 MB") using Swift's built-in ByteCountFormatter class, including code examples and a reusable extension.

How to get file size using FileManager + formatting

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week