How to get the length of the string as bytes in Nodejs?
Originally posted here!
To get the string length in bytes in Node.js, you can use the byteLength() method in the Buffer class.
Let's say you have a string called Hello World!,
// string
const str = "Hello World!";
Now let's use the Buffer.byteLengt...
melvingeorge-me.hashnode.dev1 min read