DelfiniItemWriterBinary

class pydelfini.item_io.DelfiniItemWriterBinary(collection_id, version_id, item_id, client)[source]

Bases: DelfiniItemWriterCore, BinaryIO

File-like interface for writing binary data to items.

It is important to either use this in a context manager or else call the close() method when writing is complete, otherwise the full contents of the file may not be written.

Suggested usage:

with item.open('wb') as fp:
    fp.write(b'my item content, as much as I have\n')

Attributes

closed

mode

name

Parameters:
close()

Close and flush the stream, completing the file write.

Return type:

None

fileno()

N/A - not a real file

Raises:

OSError – always

Return type:

int

isatty()

Always False

Return type:

bool

read(n=-1)[source]

N/A - cannot read

Raises:

OSError – always

Parameters:

n (int)

Return type:

bytes

readable()

Always False

Return type:

bool

readline(limit=-1)[source]

N/A - cannot read

Raises:

OSError – always

Parameters:

limit (int)

Return type:

bytes

readlines(hint=-1)[source]

N/A - cannot read

Raises:

OSError – always

Parameters:

hint (int)

Return type:

list[bytes]

seek(offset, whence=0)

N/A - not a real file

Raises:

OSError – always

Parameters:
Return type:

int

seekable()

Always False

Return type:

bool

truncate(size=None)

N/A - not a real file

Raises:

OSError – always

Parameters:

size (int | None)

Return type:

int

writable()

Always True

Return type:

bool

write(s)[source]

Write to the stream.

Parameters:

s (bytes | Buffer) – content to write

Returns:

number of bytes written

Return type:

int

writelines(lines)[source]

Write lines to the stream.

Parameters:

lines (Iterable[bytes] | Iterable[Buffer]) – iterable of lines (bytes or Buffer) to write

Return type:

None