read function of fuse

patatetom at gmail.com patatetom at gmail.com
Sat Mar 3 05:37:09 EST 2018


hello,

my xb360hd module allows me to browse a xtaf partition (xbox360) and extract files.

a file can be large (and discontinuous), so the readFile function of the module returns a generator.

from a console, I can "easily" copy a file with this piece of code:

partition = xb360hd.Xtaf('/dev/sdb')
with open ('/tmp/copy',' wb') as copy:
	for data in partition.readFile(partition.getEntry('/path/to/un/file'):
		copy.write(data)

So far so good.

I'm now trying to make the contents of the partition accessible "naturally" with my xtaffuse module, but I'm blocking on the read function of fusepy and don't see how to return the content of the file without having to read it completely and store it temporarily in variable, and therefore in memory.

thank for your help.
 
(If the read function of the xtaffuse module returns directly the generator from the readFile function of the xb360hd module, I have the error "object of type' generator' has no len ()" / I don't want to use a temporary file between readFile of the xb360hd module and read of the xtaffuse module)

xb360hd: https://github.com/patatetom/xtaf/blob/master/xb360hd.py
xtaffuse: https://github.com/patatetom/xtaf/blob/master/xtaffuse.py
fusepy: https://github.com/fusepy/fusepy
xtaf: http://www.free60.org/wiki/FATX

Translated with www.DeepL.com/Translator



More information about the Python-list mailing list