There's a line at the top: if ( typeof buffer === 'number' ) I take it this is intended to convert a plain array to an ArrayBuffer, but it doesn't work as written. I changed it to if ( typeof buffer[0] === 'number' ) ...in my work tree, which I think is what you meant.