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
äáöü
If you want to specific encoded, here is iconv example
iconv
var iconv = require('iconv-lite'); var buf =iconv.encode('äáöü', 'utf8'); console.log(buf.length); // output: 8