Utilities

FileCopier

When called with the mode='FileCopier' argument, Flow.get can return a FileCopier instance. This is simply a utility class that exposes a copy method, enabling the user to copy files around without knowing any internal details about where Bionic stores them.

FileCopier API

class bionic.filecopier.FileCopier(src_file_path)[source]

A wrapper for a Path object, exposing a copy method that will copy the underlying file to a local or cloud destination.

Parameters

src_file_path (Path) – A path to a file.

copy(destination)[source]

Copies file that FileCopier represents to destination

This supports both local and GCS destinations. For the former, we follow cp’s conventions and for the latter we follow fsspec’s put / put_file APIs which can be found at https://filesystem-spec.readthedocs.io/en/latest/api.html#fsspec.spec.AbstractFileSystem.

Parameters

destination (Path or str) – Where to copy the underlying file