TextDecoder should accept GBytes
TextDecoder.decode
should accept GBtytes
- https://gjs-docs.gnome.org/gjs/encoding.md#textdecoder
- https://gjs-docs.gnome.org/glib20~2.0/glib.bytes
i don't see a problem treating GBytes as equivalent to a Uint8Array in that way, i believe they largely behave the same way
Getting a string value in GJS can sometimes feel unnecessary difficult.
For example
const bytes = output_stream.steal_as_bytes();
const text_decoder = new TextDecoder("utf-8");
return text_decoder.decode(bytes.toArray().buffer);
We can make this slightly better by accepting GBytes in TextDecoder
const bytes = output_stream.steal_as_bytes();
const text_decoder = new TextDecoder("utf-8");
return text_decoder.decode(bytes); // this changed