I want to truncate a piece of utf8 encoded text to a given length in bytes. For example, if the text is
Hello , I like rice cakes ¯\_(ツ)_/¯
I would like to truncate that text to 10 bytes max.
I found the truncate-utf8-bytes NPM module that does exactly what I need, unfortunately, the project I am working on doesn't use webpack or browerify so I cannot use those NPM modules as far as I'm aware
So I was wondering if there was a reliable way to truncate the text, or if there was a way for me to use the truncate-utf8-bytes module in the browser.
Thanks