duck.utils.fileΒΆ

File Management Utilities Module

Provides utility functions for file operations such as reading, writing, renaming, moving, and deleting files.

Module ContentsΒΆ

FunctionsΒΆ

delete_file

Deletes a file.

move_file

Moves a file from the source path to the destination path.

read_file

Reads the contents of a file.

write_to_file

Writes data to a file.

APIΒΆ

duck.utils.file.delete_file(file_path: str) β†’ None[source]ΒΆ

Deletes a file.

Parameters:

file_path – The file path to delete.

duck.utils.file.move_file(source: str, destination: str) β†’ None[source]ΒΆ

Moves a file from the source path to the destination path.

Parameters:
  • source – The source file path.

  • destination – The destination file path.

duck.utils.file.read_file(file_path: str) β†’ str[source]ΒΆ

Reads the contents of a file.

Parameters:

file_path – The file path to read from.

Returns:

The contents of the file.

Return type:

str

duck.utils.file.write_to_file(file_path: str, data: str) β†’ None[source]ΒΆ

Writes data to a file.

Parameters:
  • file_path – The file path to write to.

  • data – The data to write.