pg.io.MemoryFile#

Accessible via pg.io.MemoryFile.

class MemoryFile(buffer)[source]#

Bases: pg.io.File

Memory file.

Methods:

close()

Closes the file.

read([size])

Reads the content of the file.

readline()

Reads the next line.

seek(offset[, whence])

Changes the current position of the file.

tell()

Returns the current position of the file.

write(content)

Writes the content of the file.

close()[source]#

Closes the file.

Return type:

None

read(size=None)[source]#

Reads the content of the file.

Return type:

Union[str, bytes]

readline()[source]#

Reads the next line.

Return type:

Union[str, bytes]

seek(offset, whence=0)[source]#

Changes the current position of the file.

Return type:

int

Parameters:
  • offset – Offset from the position to a reference point.

  • whence – The reference point, with 0 meaning the beginning of the file, 1 meaning the current position, or 2 meaning the end of the file.

Returns:

The position from the beginning of the file.

tell()[source]#

Returns the current position of the file.

Return type:

int

write(content)[source]#

Writes the content of the file.

Return type:

None