Storage¶
The BrainFrame server has a generic API for file storage that is used by other
API endpoints. If a method asks for a storage_id
field, it’s looking for a
file uploaded using these methods.
API Methods¶
-
BrainFrameAPI.
get_storage_data
(storage_id, timeout=30) → Tuple[bytes, str]¶ Returns the data with the given storage ID.
- Parameters
storage_id – The ID of the storage object to get
timeout – The timeout to use for this request
- Returns
The data and MIME type of that data
-
BrainFrameAPI.
get_storage_data_as_image
(storage_id, timeout=30) → numpy.ndarray¶ Gets the data with the given storage ID and attempts to load it as an image with OpenCV.
- Parameters
storage_id – The ID of the storage object to get
timeout – The timeout to use for this request
- Returns
A numpy array in OpenCV format
-
BrainFrameAPI.
new_storage
(data: Union[bytes, BinaryIO, Iterable], mime_type: str, timeout=30) → int¶ Stores the given data.
- Parameters
data – The data to store, either as bytes or as a file-like
mime_type – The MIME type of the data
timeout – The timeout to use for this request
- Returns
The storage ID
-
BrainFrameAPI.
new_storage_as_image
(data: bytes, timeout=30) → int¶ Stores the given image data, and inspects it to figure out what the MIME type of the data.
- Parameters
data – The image data to store
timeout – The timeout to use for this request
- Returns
The storage ID
-
BrainFrameAPI.
delete_storage
(storage_id, timeout=30)¶ Deletes the storage object with the given ID. Deleting storage objects that are in use, like for an encoding, is not recommended.
- Parameters
storage_id – The ID of the storage object to delete
timeout – The timeout to use for this request