Can mmap and gzip collaborate?

后端 未结 2 1817
轮回少年
轮回少年 2021-02-13 17:49

I\'m trying to figure how to use mmap with a gzip compressed file. Is that even possible ?

import mmap
import os
import gzip

filename = r\'C:\\temp\\data.gz\'

file          


        
2条回答
  •  抹茶落季
    2021-02-13 18:18

    Well, not the way you want.

    mmap() can be used to access the gzipped file if the compressed data is what you want.

    mmap() is a system call for mapping disk blocks into RAM almost as if you were adding swap.

    You can't map the uncompressed data into RAM with mmap() as it is not on the disk.

提交回复
热议问题