pyarrow.memory_mapยถ

pyarrow.memory_map(path, mode='r')ยถ

Open memory map at file path. Size of the memory map cannot change.

Parameters:
pathstr
mode{โ€˜rโ€™, โ€˜r+โ€™, โ€˜wโ€™}, default โ€˜rโ€™

Whether the file is opened for reading (โ€˜rโ€™), writing (โ€˜wโ€™) or both (โ€˜r+โ€™).

Returns:
mmapMemoryMappedFile

Examples

Reading from a memory map without any memory allocation or copying:

>>> import pyarrow as pa
>>> with pa.output_stream('example_mmap.txt') as stream:
...     stream.write(b'Constructing a buffer referencing the mapped memory')
...
51
>>> with pa.memory_map('example_mmap.txt') as mmap:
...     mmap.read_at(6,45)
...
b'memory'