encode raw buffer types as Uint8Array's