download
DownloadDataEntry
from dara.core.internal.download import DownloadDataEntry
class DownloadDataEntry(BaseModel)
Entry stored in the download registry for a given code.
Attributes
- uid: str
- file_path: str
- cleanup_file: bool
- identity_name: Optional[str]
- download: Callable[[], Awaitable[Tuple[Callable[Awaitable]]]]
download
Handler for getting the file from the entry
download
async def download(
data_entry: DownloadDataEntry
) -> Tuple[anyio.AsyncFile, Callable[..., Awaitable]]
Get the loaded filename and path from a code
Arguments:
code: one-time download code
Returns:
tuple of (async file, cleanup function)
generate_download_code
async def generate_download_code(file_path: str, cleanup_file: bool) -> str
Generate a one-time download code for a given dataset.
Arguments:
file_path: path to file