Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Binary strings

Nos bénévoles n'ont pas encore traduit cet article en Français. Aidez-nous à réaliser cette tâche !

Summary

In simple words, a binary string is a sequence of 1's and 0's. Javascript is loaded with rich features to manipulate the raw binary data in lower level. 

As web applications become more and more powerful, adding features such as audio and video manipulation, access to raw data using WebSockets, and so forth, it has become clear that there are times when it would be helpful for JavaScript code to be able to quickly and easily manipulate raw binary data. In the past, this had to be simulated by treating the raw data as a string and using the charCodeAt() method to read the bytes from the data buffer.

However, this is slow and error-prone, due to the need for multiple conversions (especially if the binary data is not actually byte-format data, but, for example, 32-bit integers or floats).

JavaScript typed arrays provide a mechanism for accessing raw binary data much more efficiently. The StringView Non native constructor is one level above typed arrays and provides a C-like interface for strings.

See also

Étiquettes et contributeurs liés au document

 Contributeurs à cette page : rhyne24, kscarfone, ethertank, fusionchess
 Dernière mise à jour par : rhyne24,