Decoding Uint8Array to Other Data Types in Effect Typescript Library
I see helpers in schema that decode other datatypes to a
I feel like I'm missing something obvious or being dumb here
. Are they missing because we just haven't gotten around to it yet, or do I have some incorrect assumptions somewhere
?
Context:
I'm working on a service that consumes messages from google pubsub. The
I was hoping to instead to use something like
It seems simple enough to make my own (code below), but I wanted to make sure I wasn't missing something obvious/built-in. Seems like it would be a pretty common use-case for
Uint8Array (Schema.Uint8ArrayFromX), but I'm not seeing any helpers that take a Uint8Array and decode it to other datatypes (Schema.XFromUint8Array).I feel like I'm missing something obvious or being dumb here
Context:
I'm working on a service that consumes messages from google pubsub. The
data you publish ends up as a string | Uint8Array<ArrayBufferLike> when consuming. Without effect, decoding the data as the consumer looks something like this:I was hoping to instead to use something like
Schema.StringFromUint8Array and compose that with Schema.parseJson(MyMessageType), but that doesn't exist.It seems simple enough to make my own (code below), but I wanted to make sure I wasn't missing something obvious/built-in. Seems like it would be a pretty common use-case for
Uint8Array to be treated as the "encoded" format that you'd decode to other datatypes 