Closed repomaa closed 5 years ago
I'm not sure if duplicating the file entry is the best solution.
You can already access the raw data as #to_slice
and write that to an IO (or wrap it in a memory IO).
Hm yeah I know but i thought it'd be nicer to preserve the interface. Isn't duplicating the file just passing some references around?
Oh.. no it's not. Slice is a struct of course. Ok this is a bad idea indeed.
No, it's not duplicating the actual data. Slice
is essentially just a pointer with size. That's not an issue.
But duplicating the file entry doesn't make much sense and can be surprising. It's cleaner to have just one instance per entry but having different means for accessing compressed or uncompressed data. IMHO that's already provided for.
Do you have a use case where #to_slice
isn't enough?
yeah to_slice
should be fine..
This is really useful for web servers when you don't want to decompress and then compress again with the HTTP::CompressHandler