I'm missing something basic I think.
I have a file read into a vector:
std::vector<uint8_t>fileBuffer((std::istreambuf_iterator<char>(file)), (std::istreambuf_iterator<char>()));
I want to load it into a js Uint8Array. The only way that works for me so far is one byte at a time:
for (int i = 0; i < fileBuffer.size(); ++i){
uint8_t byte = fileBuffer[i];
jsContext.invoke("putByte", byte);
}
This is pretty slow. I can pass a pointer, but not sure how to de reference that on the js side.
What's the best way to do this?
Many Thanks!