Tempfile & Tempdir is the way to create temporary files and directories.
It’s handy in cases where you need to process a file but don’t need it after you are done with the processing.
Tempfiles and Tempdirs are cleaned up automatically as soon as you loose reference to it.
You can also manually
unlink a Tempfile, Which is useful in cases where you want to delete
it right away.
Tempdir is avilable in almost all modern programming languages.
Here it is documented in Ruby and Python