Hi,

On 14/07/2020 18:49, キャロウ マーク wrote:
>
>
>> On Jul 14, 2020, at 8:37, 'Sam Clegg' via emscripten-discuss
>> <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>>
>>
>> On Mon, Jul 13, 2020 at 6:43 PM キャロウ マーク <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>>     Is is possible to use a typed array created on HEAP8 with
>>     XMLHttpRequest as the destination for the incoming data?
>>
>>
>> I don't think so no.   IIRC  XMLHttpRequest API pre-dates the typed
>> array APIs.
>
> XMLHttpRequest most definitely supports receiving responses into
> ArrayBuffers. You set responseType=‘arrayBuffer’. However now I look
> more closely at the API there doesn’t seem to be any way to provide it
> with the destination ArrayBuffer. It looks like XMLHttpRequest always
> creates it itself which makes my question moot.
One optimization I did for RenPyWeb was importing XMLHttpRequest's
buffer into the filesystem (FS):
https://github.com/renpy/renpy/blob/8b0d3dd4986a5a8656b3a5ad634c62bd52b1afbd/renpy/webloader.py#L64
FS.writeFile(path, new Uint8Array(xhr.response), {canOwn:true});

I'm not sure what's your use case is, it might help.

Cheers!
Beuc

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/cb9bca95-877c-3a6d-921a-e9b093f57b33%40beuc.net.

Reply via email to