I tried using this module and hit the "expected Uint8Array" exception. Problem seems to be that the caller is running in a sandbox (via vm module), so its Uint8Array class is coming from a different scope. It might be better to test for buf.BYTES_PER_ELEMENT == 1.