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

1
The Beautiful Web
Jens Oliver Meiert 2 votes
3
LLM Use in the Python Source Code
Miguel Grinberg 1 votes
4
Wagon’s algorithm in Python
John D. Cook 1 votes