robinrodricks / FluentFTP

An FTP and FTPS client for .NET & .NET Standard, optimized for speed. Provides extensive FTP commands, File uploads/downloads, SSL/TLS connections, Automatic directory listing parsing, File hashing/checksums, File permissions/CHMOD, FTP proxies, FXP support, UTF-8 support, Async/await support, Powershell support and more. Written entirely in C#.
MIT License
2.99k stars 646 forks source link

Should FTP work be done with temp files? #1573

Closed holm76 closed 1 month ago

holm76 commented 1 month ago

I apologize if this question is more of a StackOverflow question but maybe these things are already worked into FluentFTP.

So as I understand it FTP does not lock files when they are uploading or downloading.

So how do I implement a 'safe' set of usability APIs?

For upload should I upload to a temp file and then when upload is done rename the file to intended name? And for download how can I know if an upload is in progress? And also when downloading should I create a copy of the file and then download the copy?

So these operations are pretty fast for small files but may become more important when dealing with larger files and then having polling services that look file new files or file changes.

What are the best practices when exposing these kinds of functions?

robinrodricks commented 1 month ago

These are application level concerns that should be handled on your end. We have no way of handling these things internally, nor do we have the scope for it.

holm76 commented 1 month ago

I do agree with you. Was looking for best practice solutions but I can probably find those other places.

FanDjango commented 1 month ago

These are application level concerns that should be handled on your end.

+1

And if these concerns are of importance to you, you need to re-evaluate choosing FTP as your chosen file transfer protocol. Many of these concerns would need at least a "matched client-server pair". Most servers don't offer any of the needed functionality and it is not part of the FTP RFCs anyway - so it would be non-standard.

holm76 commented 1 month ago

Yeah unfortunately we don't have a choice on protocol. We are adding support requested by customer. They need FTP support for monitoring files from a 3. party system that use FTP to transfer files.

And I still agree. FTP is not the best choice but currently the only choice available.

I guess we will do our implementation v1 and then work from there if errors occur.

Thanks.

robinrodricks commented 1 month ago

Closing as we cannot really help out here.