How to get the string length in bytes in nodejs? If I have a string, like this: äáöü then str.length will return with 4. But how to get that, how many bytes form th
äáöü
Alternatively, you can use TextEncoder
new TextEncoder().encode(str).length
Related question
Assume it's slower though