Make TypeArray deref into slices? #3806
-
SummaryMaybe I'm missing something, but is there any way to take a typed array (say, UInt8Array) and turn it into a In my use case I load a large image as an |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Unfortunately this is technically not possible. An The solution is to accept a |
Beta Was this translation helpful? Give feedback.
Unfortunately this is technically not possible. An
ArrayBuffer
represents external memory that can't be represented in pointers to the internal memory in Wasm (I don't believe the multi-memory proposal can fill that gap as well).The solution is to accept a
Uint8Array
instead of an&[u8]
to avoid having to copy everything into the Wasm memory, as long as that fits your requirements.