临时文件系统

临时文件系统存储在您的操作系统定义的位置(linux上的``/ tmp``)。 当文件系统关闭时,内容被删除。

TempFS是提前准备目录结构的好方法,以便以后复制。它也可以用作临时数据存储。

class fs.tempfs.TempFS(identifier=None, temp_dir=None, auto_clean=True, ignore_clean_errors=True)

Create a temporary filesystem.

参数:
  • identifier (str) – A string to distinguish the directory within the OS temp location, used as part of the directory name.
  • temp_dir (str) – An OS path to your temp directory (leave as None to auto-detect)
  • auto_clean (bool) – If True, the directory contents will be wiped on close.
  • ignore_clean_errors (bool) – If True, any errors in the clean process will be raised. If False, they will be suppressed.
clean()

Clean (delete) temporary files created by this filesystem.