backend_for_stream#

lsst.images.serialization.backend_for_stream(stream: IO[bytes]) Backend#

Return the Backend for stream based on its leading bytes.

The stream is restored to the position it was passed in with. Compressed content is not accepted: whoever produced the stream knows how it was compressed and decompresses it before handing it over.

Parameters#

stream

Seekable binary stream positioned at the start of the data.

Raises#

ValueError

If the leading bytes match no supported format, including when they carry gzip or zstd compression magic.