* Convert a string that pass as a "binary string": it should represent a byte * array but may have > 255 char codes. Be sure to take only the first byte * and returns the byte array. * @param {String} str the string to transform. * @return {Array|Uint8Array} the string in a binary format.
(str)
| 15 | * @return {Array|Uint8Array} the string in a binary format. |
| 16 | */ |
| 17 | function string2binary(str) { |
| 18 | var result = null; |
| 19 | if (support.uint8array) { |
| 20 | result = new Uint8Array(str.length); |
| 21 | } else { |
| 22 | result = new Array(str.length); |
| 23 | } |
| 24 | return stringToArrayLike(str, result); |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Create a new blob with the given content and the given type. |
no test coverage detected