PurpleKingdomGames / tyrian

Elm-inspired Scala UI library.
https://tyrian.indigoengine.io/
MIT License
346 stars 26 forks source link

Adding API on cmd.FileReader for reading a file as ArrayBuffer #251

Closed KristianAN closed 7 months ago

KristianAN commented 8 months ago

This commit adds implementation of support for dom.FileReader.readAsArrayBuffer as public API of the cmd.FileReader object exposing a function that reads the file as a Vector[Byte] using the typdarray api.

Updated goodies.md with new API

fixes #249

KristianAN commented 8 months ago

Should this use the new Scala 3 IArray instead of Vector?

KristianAN commented 7 months ago

Updated the error message and changed to use IArray. Note that caling toArray on an IArray produces this error message

method toArray in object IArray is deprecated since 3.0.1: This method implementation is incorrect and calling it can crash your program, please use `IArray.genericWrapArray(myIArray).toArray` instead. bloop [645, 43]

I don't really see this as an issue as the error message is descriptive enough.

davesmith00000 commented 7 months ago

I don't really see this as an issue as the error message is descriptive enough.

Yes I'm fine with that too, it's a Scala thing, not a Tyrian thing. :+1: