Meshtastic-Apple/Meshtastic/Extensions/Url.swift
Garth Vander Houwen a990d7f2bd Lint
2023-08-26 23:17:30 -07:00

20 lines
424 B
Swift

//
// Url.swift
// Meshtastic
//
// Copyright(c) Garth Vander Houwen 5/5/23.
//
import Foundation
extension URL {
func regularFileAllocatedSize() throws -> UInt64 {
let resourceValues = try self.resourceValues(forKeys: allocatedSizeResourceKeys)
guard resourceValues.isRegularFile ?? false else {
return 0
}
return UInt64(resourceValues.totalFileAllocatedSize ?? resourceValues.fileAllocatedSize ?? 0)
}
}