bufferToArrayBuffer should pass optional encoding