proposal: DataView.prototype.toString(start = 0, end = this.length, enc= "utf8")

Ali Rahbari rahbari at gmail.com
Wed Aug 22 01:31:25 UTC 2018


When working with binary data, reading string from buffer is a necessity.
For example when deserializing bson data in the browser.

Most of node.js buffer methods are available in DataView except toString.
As a workaround currently it's done by reading the buffer byte by byte and
convert each of them to corresponding character with String.fromCharCode()
and then joining the result.

This can be done much faster in native code.

DataView.prototype.toString(start = 0, end = this.length, encoding= "utf8")

DataView.prototype.writeString(string, offset = 0, length = string.length,
encoding = "utf8")

-- 
Ali Rahbari
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180822/0b4fb666/attachment.html>


More information about the es-discuss mailing list