vis4d.data.io.file

Standard backend for local files on a hard drive.

This backends loads data from and saves data to the local hard drive.

Classes

FileBackend()

Raw file from hard disk data backend.

class FileBackend[source]

Raw file from hard disk data backend.

close()[source]

No need to close manually.

Return type:

None

exists(filepath)[source]

Check if filepath exists.

Parameters:

filepath (str) – Path to file.

Returns:

True if file exists, False otherwise.

Return type:

bool

get(filepath)[source]

Get file content as bytes.

Parameters:

filepath (str) – Path to file.

Raises:

FileNotFoundError – If filepath does not exist.

Returns:

File content as bytes.

Return type:

bytes

isfile(filepath)[source]

Check if filepath is a file.

Parameters:

filepath (str) – Path to file.

Returns:

True if file exists, False otherwise.

Return type:

bool

listdir(filepath)[source]

List all files in the directory.

Parameters:

filepath (str) – Path to file.

Returns:

List of all files in the directory.

Return type:

list[str]

set(filepath, content, mode='w')[source]

Write the file content to disk.

Parameters:
  • filepath (str) – Path to file.

  • content (bytes) – Content to write in bytes.

  • mode (Literal["w", "a"], optional) – Overwrite or append mode. Defaults to “w”.

Return type:

None