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

Error downloading stream #36

Closed
ghost opened this issue Mar 21, 2016 · 5 comments
Closed

Error downloading stream #36

ghost opened this issue Mar 21, 2016 · 5 comments

Comments

@ghost
Copy link

ghost commented Mar 21, 2016

em System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
em System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
em System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
em CG.Web.MegaApiClient.MegaApiClient.SaveStream(Stream stream, String outputFile)
em CG.Web.MegaApiClient.MegaApiClient.<>c__DisplayClass54_0.b__0()
em System.Threading.Tasks.Task.InnerInvoke()

@gpailler
Copy link
Owner

It's the typical exception you receive when the destination file already exists. If you take a look on the exception message, you should have something like The file 'myfile.myext' already exists.

Can you confirm?

MegaApiClient never overwrite files so you should catch this kind of exception and take appropriate actions in you code to ensure the destination file doesn't exist.

@ghost
Copy link
Author

ghost commented Mar 22, 2016

hum, maybe you're right, is there anyway to replace the file?

@gpailler
Copy link
Owner

Currently there is nothing in MegaApiClient to overwrite a file (on purpose for safety reason).
In any case, you should try/catch this kind of call because even MegaApiClient was able to overwrite a file, there is lot of possible exception (the file is locked, a race condition, the drive is absent...)

@ghost
Copy link
Author

ghost commented Mar 22, 2016

Yes you're right... what i was talking about an overload to the function DownloadFileAsync that allows to replace the files

@gpailler
Copy link
Owner

@silvermcd123 I understood your request about overloaded method. If you want, you can submit a PR with the changes and I'll be glad to integrate it but as I said, even with this new overloaded method, you still need to try/catch the Download method because other kind of exceptions can be raised

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