Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FTPFileProvider return Error Domain=NSPOSIXErrorDomain for files over 5gb #183

Open
nastasiupta opened this issue Mar 24, 2023 · 0 comments

Comments

@nastasiupta
Copy link

nastasiupta commented Mar 24, 2023

Everything works perfect for smaller files, I tested it with bigger batch files etc, but it's not working properly for a big file.
I'm using copy method to download the file to user's mac.

let credential = URLCredential(user: ftpCredentials.username, password: ftpCredentials.password, persistence: .permanent)
var components = URLComponents()
components.host = ftpCredentials.host
components.scheme = "ftp"
if let portInt = Int(ftpCredentials.port) {
    components.port = portInt
}
guard let url = components.url,
      let fileProvider = FTPFileProvider(baseURL: url, mode: ftpCredentials.passiveConnection ? .passive : .active, credential: credential) else { return }
data.fileProvider.copyItem(path: data.object.path, toLocalURL: data.fileDestinationURL, completionHandler: { [weak self] error in
    DispatchQueue.main.async {
        guard let strongSelf = self else { return }
        if let error = error {
            completion?(error.localizedDescription, .init(request: data, newFileStatus: .errorOccured))
        } else {
            completion?(nil, .init(newFileStatus: .mediaUploadPending))
        }
    }
})

Also, I noticed that the file is not displayed during the download, but it is at the end, can this be changed?
During the copy operation, looks like the file is loaded in the RAM memory ... I think if there is an option to solve the issue mentioned above, we can also limit de amount of ram allocation.

Printing description of error:
▿ Optional<Error>
  - some : Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument" UserInfo={_kCFStreamErrorCodeKey=22, _kCFStreamErrorDomainKey=1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant