javascript - Is WebAPI Body.json asynchronous? -
body.json
returns promise.
is method asynchronous avoid blocking on reading large inbound data streams?
does settimeout(samplestream, 0)
repeatedly until end of stream found?
is
.json()
asynchronous?
yes. that's why returns promise.
is method asynchronous avoid blocking on reading large inbound data streams?
yes. receive response
right after headers arrived, , receiving body might take time.
does
settimeout(samplestream, 0)
repeatedly until end of stream found?
not exactly. doesn't use settimeout
, reads stream repeatably getting promises next chunk - check reading bytes readablestream yourself.
, importantly, happens on background task without concerns javascript. note on section tells: because reader grants exclusive access, actual mechanism of how read cannot observed. implementations use more direct mechanism if convenient.
Comments
Post a Comment