Get operating system's default directory for temporary files with Node
08-01-2021 | #nodejs
Temporary files are useful when you process files but don't want to save them permanently. You may just use them to save the data of your application's session.
To know where the temporary files are saved in the operating system with Node, you can use the
tmpdir() method of the
os.tmpdir(); // C:\\Users\\phong\\AppData\\Local\\Temp
It doesn't accept any parameters and returns the path of the operating system's default directory for temporary files.