#how to get raw `Response` string

14 messages · Page 1 of 1 (latest)

tired jewel
#

Hey, so I have a fetch response and I want to read it as a raw string, how can I do this? .json only deserializes right?

carmine leaf
#

.text()?

tired jewel
#

ah thanks a lot

carmine leaf
#

iirc there's .json(), .text(), .blob() and maybe .buffer(), not sure about that last one

tired jewel
#

buffer is for big responses I believe

carmine leaf
tired jewel
#

blob seems pretty handy

carmine leaf
#

blob and arrayBuffer are just ways to get the raw binary data

#

not necessarily big responses

#

arrayBuffer represents data, blob represents a file, iirc.

tired jewel
#

right

#

well this is my first time writing typescript

#

using svelteKit, I come from C#

#

thanks anyways