archive icon indicating copy to clipboard operation
archive copied to clipboard

Binary data should be represented by `Uint8List`s

Open ueman opened this issue 1 year ago • 2 comments

Using Uint8List is more performant and resourceful for representing binary data. The archive package should therefore try to use Uint8Lists instead of List<int>s.

See also the notes on its documentation here.

ueman avatar Sep 15 '24 11:09 ueman

Yes, the library does already use Uint8List internally. List is the interface Uint8List implements.

brendan-duncan avatar Sep 15 '24 13:09 brendan-duncan

It would be nice to then also expose it as such for v4. Having List<int> as a type to work with makes glue code annoying, since you always have to check whether a List<int> is a Uint8List or you have to convert it to a Uint8List.

Also, thanks for providing this awesome library!

ueman avatar Sep 15 '24 14:09 ueman

I've been away from working on this library for a while, but am getting back to it to get V4 ready to ship.

Taking a look at V4 it should already be using Uint8List for return values, except for some alias methods I kept in for backward compatibility. They'll generally still use List for arguments, to be more flexible.

brendan-duncan avatar Nov 02 '24 19:11 brendan-duncan