python-snappy icon indicating copy to clipboard operation
python-snappy copied to clipboard

A way to specify offset/length when compressing and uncompressing

Open bgedik opened this issue 8 years ago • 3 comments

If I want to compress or uncompress only a view of my string/data, I don't see a way to do that without creating a copy. Do you think this can be added.

bgedik avatar Feb 19 '17 15:02 bgedik

Have you considered using memoryview as a pure-python way to implement this?

martindurant avatar May 04 '17 18:05 martindurant

Yes. It gives the following error: exceptions.TypeError: must be string or read-only buffer, not memoryview

bgedik avatar May 04 '17 19:05 bgedik

I see, sorry to hear that. Ideally it ought to work with memoryviews, but I see that the code is written in a pretty py2 kind of style. Allowing an offset parameter doesn't sound too hard to implement, but I don't quite know how, I didn't write the original code. Perhaps an extra parameter to here?

martindurant avatar May 04 '17 20:05 martindurant