Serialization and Deserialization of Vuer Data Types
vuer.serdes#
- class vuer.serdes.BytesIO#
Bases:
_BufferedIOBaseBuffered I/O implementation using an in-memory bytes buffer.
- __new__(**kwargs)#
- close()#
Disable all I/O operations.
- closed#
True if the file is closed.
- flush()#
Does nothing.
- getbuffer()#
Get a read-write view over the contents of the BytesIO object.
- getvalue()#
Retrieve the entire contents of the BytesIO object.
- isatty()#
Always returns False.
BytesIO objects are not connected to a TTY-like device.
- read(size=-1, /)#
Read at most size bytes, returned as a bytes object.
If the size argument is negative, read until EOF is reached. Return an empty bytes object at EOF.
- read1(size=-1, /)#
Read at most size bytes, returned as a bytes object.
If the size argument is negative or omitted, read until EOF is reached. Return an empty bytes object at EOF.
- readable()#
Returns True if the IO object can be read.
- readinto(buffer, /)#
Read bytes into buffer.
Returns number of bytes read (0 for EOF), or None if the object is set not to block and has no data to read.
- readline(size=-1, /)#
Next line from the file, as a bytes object.
Retain newline. A non-negative size argument limits the maximum number of bytes to return (an incomplete line may be returned then). Return an empty bytes object at EOF.
- readlines(size=None, /)#
List of bytes objects, each a line from the file.
Call readline() repeatedly and return a list of the lines so read. The optional size argument, if given, is an approximate bound on the total number of bytes in the lines returned.
- seek(pos, whence=0, /)#
Change stream position.
- Seek to byte offset pos relative to position indicated by whence:
0 Start of stream (the default). pos should be >= 0; 1 Current position - pos may be negative; 2 End of stream - pos usually negative.
Returns the new absolute position.
- seekable()#
Returns True if the IO object can be seeked.
- tell()#
Current file position, an integer.
- truncate(size=None, /)#
Truncate the file to at most size bytes.
Size defaults to the current file position, as returned by tell(). The current file position is unchanged. Returns the new size.
- writable()#
Returns True if the IO object can be written.
- write(b, /)#
Write bytes to file.
Return the number of bytes written.
- writelines(lines, /)#
Write lines to the file.
Note that newlines are not added. lines can be any iterable object producing bytes-like objects. This is equivalent to calling write() for each element.
- vuer.serdes.serializer(data)#
- vuer.serdes.jpg(image, quality: int = 90)#
base64 encode the image into a string, using JPEG encoding
Does not support transparency.
- Parameters:
quality (int) –
- vuer.serdes.png(image)#
base64 encode the image into a string, using PNG encoding
- vuer.serdes.b64jpg(image, quality: int = 90)#
base64 encode the image into a string, using JPEG encoding
Does not support transparency.
- Parameters:
quality (int) –
- vuer.serdes.b64png(image)#
base64 encode the image into a string, using PNG encoding