Factor out the arrayBufferToArray function into utils.js.