If you are looking for a solution that works in node.js, you can use this:
var myBuffer = [];
var str="Stack Overflow";
var buffer = new Buffer(str, 'utf16le');
for (var i = 0; i < buffer.length; i++) {
myBuffer.push(buffer[i]);
}
console.log(myBuffer);
More Related Contents:
- javascript: hiding contents of key
- Async function returning promise, instead of value
- Creating a textarea with auto-resize
- Javascript call() & apply() vs bind()?
- In what situations would AJAX long/short polling be preferred over HTML5 WebSockets?
- Call async/await functions in parallel
- How to append to a file in Node?
- Why does javascript object show different values in console in Chrome, Firefox, Safari? [duplicate]
- Document.write clears page
- Javascript/DOM: How to remove all event listeners of a DOM object?
- HTML button to NOT submit form
- Submit multiple forms with one submit button
- Is there a JavaScript function that can pad a string to get to a determined length?
- Pass-by-reference JavaScript objects
- localStorage object is undefined in IE
- Mousewheel event in modern browsers
- Create an empty object in JavaScript with {} or new Object()?
- Put javascript in one .js file or break it out into multiple .js files?
- How to get file name when user select a file via ?
- Problems downloading big file(max 15 mb) on google chrome
- Enable/Disable submit button if checkbox is checked/unchecked?
- How do I get basic auth working in angularjs?
- Changing the order of elements
- Is there any native function to convert json to url parameters?
- Loop in Jade (currently known as “Pug”) template engine
- How to create Javascript constants as properties of objects using const keyword?
- Iterating a JavaScript object’s properties using jQuery
- How to solve Mongoose v5.11.0 model.find() error: Operation `products.find()` buffering timed out after 10000ms”
- Javascript Get Values from Multiple Select Option Box
- How do I put this on Real-Time? I already put (async: True) but it doesnt work