jina.types.document.mixins.buffer module

class jina.types.document.mixins.buffer.BufferDataMixin[source]

Bases: object

Provide helper functions for Document to handle binary data.

load_uri_to_buffer()[source]

Convert uri to buffer inplace. Internally it downloads from the URI and set buffer.

Return type

~T

Returns

itself after processed

dump_buffer_to_datauri(charset='utf-8', base64=False)[source]

Convert buffer to data uri in place. Internally it first reads into buffer and then converts it to data URI.

Parameters
  • charset (str) – charset may be any character set registered with IANA

  • base64 (bool) – used to encode arbitrary octet sequences into a form that satisfies the rules of 7bit. Designed to be efficient for non-text 8 bit and binary data. Sometimes used for text data that frequently uses non-US-ASCII characters.

Return type

~T

Returns

itself after processed

convert_buffer_to_uri(**kwargs)
convert_uri_to_buffer(**kwargs)