fs.tools

A collection of functions that operate on filesystems and tools.

fs.tools.copy_file_data(src_file, dst_file, chunk_size=None)

Copy data from one file object to another.

参数:
  • src_file (file-like) – File open for reading.
  • dst_file (file-like) – File open for writing.
  • chunk_size (int) – Number of bytes to copy at a time (or None to use sensible default).
fs.tools.get_intermediate_dirs(fs, dir_path)

Get paths of intermediate directories required to create a new directory.

参数:
  • fs – A FS object.
  • dir_path (str) – A path to a new directory on the filesystem.
返回:

A list of paths.

返回类型:

list

引发:

fs.errors.DirectoryExpected – If a path component references a file and not a directory.

fs.tools.remove_empty(fs, path)

Remove all empty parents.

参数:
  • fs – A FS object.
  • path (str) – Path to a directory on the filesystem.