mirror of
https://github.com/rclone/rclone.git
synced 2024-12-25 16:38:59 +01:00
.. | ||
.golangci.yml | ||
doc.go | ||
go.mod | ||
go.sum | ||
LICENSE | ||
LICENSE.golang | ||
README.md | ||
tmpfile_windows.go | ||
tmpfile.go |
Cross Platform Temporary Files
This library attempts to bridge the gap between the what is provided in ioutil.TempFile and the best practice of ensuring temporary files are always deleted when the application exits.
The normal way to do this on a POSIX system is to use the behavior of unlink to immediately remove the directory entry for the temporary file. The OS then ensures that when all open file handles on the file are close that the file resources are removed. Unfortunately, despite Go having os.Remove this does not work on Windows because on Windows it is necessary to open the files with special flags (FILE_SHARE_DELETE, FILE_FLAG_DELETE_ON_CLOSE) to enable removing a file that is open (and ioutil does not do this).