File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed
Sources/MuxUploadSDK/InternalUtilities Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,9 @@ class ChunkedFile {
4646 public func openFile( fileURL: URL ) throws {
4747 if fileHandle == nil {
4848 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+ }
5052 self . _fileSize = fileSize
5153
5254 let handle = try FileHandle ( forReadingFrom: fileURL)
@@ -103,11 +105,6 @@ class ChunkedFile {
103105 return chunk
104106 }
105107
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-
111108 /// Creates a ``ChunkedFile`` that wraps the file given by the URL. The file will be opened after calling ``openFile()``
112109 init ( chunkSize: Int ) {
113110 self . chunkSize = chunkSize
You can’t perform that action at this time.
0 commit comments