bbi.files¶
Read your uploaded files from inside a notebook via bbi.files.
Files are fetched through short-lived presigned URLs minted by the backend
after an access check, so no cloud credentials ever reach the notebook.
read_csv is a convenience over pandas and read_json parses JSON into
Python objects; get_url and download are the universal primitives
that work with any format and any reader.
- list() Sequence[UserFile]¶
List the files you can access: your own plus files shared with your org.
- show() None¶
Print the files you can access as a table: name, size, visibility, owned.
- get_url(name_or_id: str) str¶
Return a short-lived presigned download URL for a file (by name or id).
- download(name_or_id: str, dest: str | None = None) str¶
Download a file to a local path and return that path. Works for any format.
- Parameters:
name_or_id – The file’s name (e.g.
"sales.csv") or its id.dest – Optional destination path. Defaults to a temp file in the kernel.
- read_bytes(name_or_id: str) bytes¶
Read a file’s raw content into memory as
bytes.
- open(name_or_id: str) BytesIO¶
Open a file as an in-memory binary stream.
Works with any
IO[bytes]-aware reader, e.g.PIL.Image.open(files.open("photo.png")).
- read_csv(name_or_id: str, **kwargs: Any) pandas.DataFrame¶
Read a CSV file into a pandas DataFrame.
kwargspass topandas.read_csv.
- read_json(name_or_id: str, **kwargs: Any) Any¶
Parse a JSON file into Python objects (dict or list).
kwargspass tojson.loads. For a DataFrame, usepandas.read_json(files.get_url(...)).