| ▲ | paxys 7 hours ago | |||||||||||||||||||||||||
There is no such thing as Uint8Array<T>. Uint8Array is a primitive for a bunch of bytes, because that is what data is in a stream. Adding types on top of that isn't a protocol concern but an application-level one. | ||||||||||||||||||||||||||
| ▲ | 85392_school 4 hours ago | parent | next [-] | |||||||||||||||||||||||||
A Uint8Array can be backed by buffers other than ArrayBuffer, which is where the types [0] come from. [0] https://github.com/microsoft/TypeScript/blob/924810c077dd410... | ||||||||||||||||||||||||||
| ▲ | softfalcon 7 hours ago | parent | prev [-] | |||||||||||||||||||||||||
> Adding types on top of that isn't a protocol concern but an application-level one. I agree with this. I have had to handle raw byte streams at lower levels for a lot of use-cases (usually optimization, or when developing libs for special purposes). It is quite helpful to have the choice of how I handle the raw chunks of data that get queued up and out of the network layer to my application. Maybe this is because I do everything from C++ to Javascript, but I feel like the abstractions of cleanly getting a stream of byte arrays is already so many steps away from actual network packet retrieval, serializing, and parsing that I am a bit baffled folks want to abstract this concern away even more than we already do. I get it, we all have our focuses (and they're ever growing in Software these days), but maybe it's okay to still see some of the bits and bytes in our systems? | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||