# nk.base64Decode() returns an ArrayBuffer, not a string in typescript

**URL:** <https://forum.heroiclabs.com/t/nk-base64decode-returns-an-arraybuffer-not-a-string-in-typescript/5151>\
**Category:** Runtime Framework\
**Tags:** typescript\
**Created:** [April 6, 2024, 6:11am UTC](https://forum.heroiclabs.com/t/nk-base64decode-returns-an-arraybuffer-not-a-string-in-typescript/5151 "2024-04-06T06:11:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![waguwagu](https://avatars.discourse-cdn.com/v4/letter/w/dfb087/32.png) [@waguwagu](https://forum.heroiclabs.com/u/waguwagu)\
**Post date:** [April 6, 2024, 6:11am UTC](https://forum.heroiclabs.com/t/nk-base64decode-returns-an-arraybuffer-not-a-string-in-typescript/5151/1 "2024-04-06T06:11:22Z")

</div>

> **[Function Reference](https://heroiclabs.com/docs/nakama/server-framework/typescript-runtime/function-reference/#base64Decode)**
>
> This page lists all functions available within Nakama's JavaScript runtime, with their respective parameters and corresponding code samples.

In the nk.base64Decode() function description, the document says it returns an ArrayBuffer, but the example code returns a string. I think it’s better to return a string if possible.

I’m having a hard time converting ArrayBuffer to string. Many of the methods recommended by Stack Overflow cause errors. 😵‍💫

```auto
*btoa is not defined.*
*TextDecoder is not defined.*
*Buffer is not defined.*

```

1. Versions: Nakama {3.20}, {Windows Docker}
2. Server Framework Runtime language {TS}

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [April 8, 2024, 11:08am UTC](https://forum.heroiclabs.com/t/nk-base64decode-returns-an-arraybuffer-not-a-string-in-typescript/5151/2 "2024-04-08T11:08:10Z")

</div>

Hello @waguwagu,

You can use `nk.binaryToString` to convert the output to a string. The example is incorrect, we’ll fix it.

Best.
