ORIONIS API REFERENCE

THE ORIONIS API

Build with clarity.

Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.

class documentation

Represent a single file on a storage disk.

The object encapsulates its canonical path and the driver of the disk it belongs to. It never knows which physical medium backs it: every operation is delegated to the driver.

Method __init__ Initialize the file with its driver and canonical path.
Async Method copyTo Copy the file to target on the same disk.
Async Method delete Delete the file from its disk.
Async Method download Copy the file to a location on the local filesystem.
Async Method exists Check whether the file exists on its disk.
Async Method hash Compute the content hash of the file.
Async Method info Collect a metadata snapshot for the file.
Async Method lastModified Return the last-modification timestamp of the file.
Async Method mimeType Guess the MIME type of the file.
Async Method moveTo Move the file to target on the same disk.
Method open Open an asynchronous binary stream over the file.
Method path Return the canonical root-relative path of the file.
Async Method read Read the full contents of the file.
Method readStream Stream the contents of the file in chunks.
Async Method rename Rename the file within its current directory.
Async Method setVisibility Change the visibility of the file.
Async Method size Return the size of the file in bytes.
Async Method temporaryUrl Build a signed, time-limited URL for the file.
Async Method url Build the public URL of the file.
Async Method visibility Return the visibility of the file.
Async Method write Write contents to the file, replacing existing data.
Async Method writeStream Write the chunks produced by stream to the file.
Class Variable __slots__ Undocumented
Instance Variable _driver Undocumented
Instance Variable _path Undocumented
def __init__(self, driver: IStorageDriver, path: str): (source)

Initialize the file with its driver and canonical path.

Parameters
driver:IStorageDriverDriver of the disk that owns the file.
path:strRoot-relative file path; normalized on ingestion.
Returns
NoneUndocumented
Raises
StoragePathExceptionIf path is invalid or resolves to the disk root.
async def copyTo(self, target: str) -> IFile: (source)

Copy the file to target on the same disk.

Parameters
target:strRoot-relative destination path.
Returns
IFileA new file object pointing at the copy.
Raises
StorageFileNotFoundExceptionIf the source file does not exist.
async def delete(self) -> bool: (source)

Delete the file from its disk.

Returns
boolTrue if the file existed and was removed.
async def download(self, destination: str | Path) -> Path: (source)

Copy the file to a location on the local filesystem.

Parameters
destination:str | PathLocal target. When it points to an existing directory the file keeps its original name inside that directory.
Returns
PathAbsolute local path of the downloaded file.
Raises
StorageFileNotFoundExceptionIf the file does not exist.
async def exists(self) -> bool: (source)

Check whether the file exists on its disk.

Returns
boolTrue if the file exists.
async def hash(self, algorithm: str = 'sha256') -> str: (source)

Compute the content hash of the file.

Parameters
algorithm:strAny algorithm name accepted by hashlib.new.
Returns
strHexadecimal digest of the file contents.
Raises
StorageFileNotFoundExceptionIf the file does not exist.
async def info(self) -> FileInfo: (source)

Collect a metadata snapshot for the file.

Returns
FileInfoImmutable entity with size, MIME type, timestamps, hashes, visibility, and URL when available.
Raises
StorageFileNotFoundExceptionIf the file does not exist.
async def lastModified(self) -> datetime: (source)

Return the last-modification timestamp of the file.

Returns
datetimeTimezone-aware modification timestamp (UTC).
Raises
StorageFileNotFoundExceptionIf the file does not exist.
async def mimeType(self) -> str | None: (source)

Guess the MIME type of the file.

Returns
str | NoneMIME type, or None when it cannot be determined.
async def moveTo(self, target: str) -> IFile: (source)

Move the file to target on the same disk.

The current object keeps pointing at the old path; use the returned object to keep working with the moved file.

Parameters
target:strRoot-relative destination path.
Returns
IFileA new file object pointing at the moved file.
Raises
StorageFileNotFoundExceptionIf the source file does not exist.
def open(self, mode: str = 'rb') -> IStorageStream: (source)

Open an asynchronous binary stream over the file.

Parameters
mode:strBinary mode: 'rb', 'wb', 'ab', 'rb+', 'wb+', or 'ab+'.
Returns
IStorageStreamLazily opened stream; use it as an async context manager.
Raises
UnsupportedStorageOperationExceptionIf mode is not a supported binary mode.
def path(self) -> str: (source)

Return the canonical root-relative path of the file.

Returns
strNormalized path relative to the disk root.
async def read(self) -> bytes: (source)

Read the full contents of the file.

Returns
bytesComplete file contents.
Raises
StorageFileNotFoundExceptionIf the file does not exist.
def readStream(self, chunk_size: int = 65536) -> AsyncIterator[bytes]: (source)

Stream the contents of the file in chunks.

Parameters
chunk_size:intMaximum number of bytes per yielded chunk.
Returns
AsyncIterator[bytes]Asynchronous iterator yielding consecutive chunks.
Raises
StorageFileNotFoundExceptionIf the file does not exist.
async def rename(self, name: str) -> IFile: (source)

Rename the file within its current directory.

Parameters
name:strNew file name without any directory separator.
Returns
IFileA new file object pointing at the renamed file.
Raises
StoragePathExceptionIf name is empty or contains a directory separator.
StorageFileNotFoundExceptionIf the source file does not exist.
async def setVisibility(self, visibility: str) -> IFile: (source)

Change the visibility of the file.

Parameters
visibility:strTarget visibility ('public' or 'private').
Returns
IFileThe file itself, enabling fluent chaining.
Raises
StorageFileNotFoundExceptionIf the file does not exist.
async def size(self) -> int: (source)

Return the size of the file in bytes.

Returns
intFile size in bytes.
Raises
StorageFileNotFoundExceptionIf the file does not exist.
async def temporaryUrl(self, expires_in: int = 3600) -> str: (source)

Build a signed, time-limited URL for the file.

Parameters
expires_in:intLifetime of the URL in seconds.
Returns
strTemporary URL valid for expires_in seconds.
Raises
UnsupportedStorageOperationExceptionIf the driver does not support temporary URLs.
async def url(self) -> str: (source)

Build the public URL of the file.

Returns
strPublicly accessible URL.
Raises
UnsupportedStorageOperationExceptionIf the disk does not expose public URLs.
async def visibility(self) -> str: (source)

Return the visibility of the file.

Returns
str'public' or 'private'.
Raises
StorageFileNotFoundExceptionIf the file does not exist.
async def write(self, contents: bytes | str, visibility: str | None = None) -> IFile: (source)

Write contents to the file, replacing existing data.

Parameters
contents:bytes | strData to persist. Strings are encoded as UTF-8.
visibility:str | NoneVisibility to apply, or None for the medium default.
Returns
IFileThe file itself, enabling fluent chaining.
async def writeStream(self, stream: AsyncIterable[bytes], visibility: str | None = None) -> IFile: (source)

Write the chunks produced by stream to the file.

Parameters
stream:AsyncIterable[bytes]Asynchronous byte-chunk producer.
visibility:str | NoneVisibility to apply, or None for the medium default.
Returns
IFileThe file itself, enabling fluent chaining.

Undocumented

Undocumented