src/retrieve.js
/**
 * Convert a String to an ArrayBuffer
 *
 * ie11 Supported
 *
 * @param str The String to convert to an ArrayBuffer
 * @returns {ArrayBuffer} The resulting array buffer encoded as utf-8
 */
Convert a String to an ArrayBuffer
ie11 Supported

@param str The String to convert to an ArrayBuffer
@returns {ArrayBuffer} The resulting array buffer encoded as utf-8
Convert a String to an ArrayBuffer ie11 Supported @param str The String to convert to an ArrayBuffer @returns { ArrayBuffer } The resulting array buffer encoded as utf - 8
function str2ab(str) {
  if (typeof TextEncoder !== 'undefined') {
    return (new TextEncoder()).encode(str).buffer;
  }
  const buf = new ArrayBuffer(str.length);
  const bufView = new Uint8Array(buf);
  for (let i = 0, strLen = str.length; i < strLen; i++) {
    bufView[i] = str.charCodeAt(i);
  }
  return buf;
}
function str2ab ( str ) { if ( typeof TextEncoder !== 'undefined' ) { return ( new TextEncoder ( ) ) . encode ( str ) . buffer ; } const buf = new ArrayBuffer ( str . length ) ; const bufView = new Uint8Array ( buf ) ; for ( let i = 0 , strLen = str . length ; i < strLen ; i ++ ) { bufView [ i ] = str . charCodeAt ( i ) ; } return buf ; }
Convert a String to an ArrayBuffer
 ie11 Supported
Convert a String to an ArrayBuffer ie11 Supported