Posts: 4,648
Threads: 1,495
Joined: Sep 2016
i have a text file. i want to read the file in a compressed form (in binary, of course). lzma.open() seems to do the opposite of what i need. it uncompresses but i need to do compression. how can i do compression and reading? i want to avoid compressing in memory.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,648
Threads: 1,495
Joined: Sep 2016
using
lzma.open()
to read a file can only uncompress. to do compression, it must be used to write a file. i want to read a file and compress it so i end up with the compressed bytes.
alas, after some other design changes, that file no long is on disk. i will have it in memory., so, i can use
lzma.LZMACompressor()
to do it all in memory and end up with the compressed bytes.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,648
Threads: 1,495
Joined: Sep 2016
(Jun-02-2021, 08:53 PM)jefsummers Wrote: So you want to read an uncompressed source file and compress it, but did not want the compression to be done in memory? Where did you want the compression to occur?
i did not want a solution that involved reading the whole file into memory and then compressing because it would take too much memory. i wanted to do incremental compression to use less memory. i've found a way to do it as the file is generated so i don't have to keep the uncompressed data.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.