File tree 1 file changed +3
-6
lines changed
Sources/MuxUploadSDK/InternalUtilities
1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,9 @@ class ChunkedFile {
46
46
public func openFile( fileURL: URL ) throws {
47
47
if fileHandle == nil {
48
48
do {
49
- let fileSize = try readFileSize ( url: fileURL)
49
+ guard let fileSize = try FileManager . default. attributesOfItem ( atPath: fileURL. path) [ FileAttributeKey . size] as? UInt64 else {
50
+ throw ChunkedFileError . invalidState ( " Cannot retrieve file size " )
51
+ }
50
52
self . _fileSize = fileSize
51
53
52
54
let handle = try FileHandle ( forReadingFrom: fileURL)
@@ -103,11 +105,6 @@ class ChunkedFile {
103
105
return chunk
104
106
}
105
107
106
- private func readFileSize( url: URL ) throws -> UInt64 {
107
- let fileAttr = try FileManager . default. attributesOfItem ( atPath: url. path)
108
- return fileAttr [ FileAttributeKey . size] as! UInt64
109
- }
110
-
111
108
/// Creates a ``ChunkedFile`` that wraps the file given by the URL. The file will be opened after calling ``openFile()``
112
109
init ( chunkSize: Int ) {
113
110
self . chunkSize = chunkSize
You can’t perform that action at this time.
0 commit comments