by andrewbarba on 12/17/21, 7:04 PM with 5 comments
by kentonv on 12/18/21, 2:58 PM
Workers' implementation of pipeTo() is indeed optimized to avoid entering the JavaScript isolate at all during the operation. I agree this probably explains the performance difference here.
For setting `Content-Length` on a streaming response, Cloudflare has a non-standard extension called `FixedLengthStream`. It works the same as an identity `TransformStream` except you pass the expected stream length to the constructor.
Example: https://cloudflareworkers.com/#c2a014c7f67df83f9ad3ea90e9c60...
We would of course prefer to implement a standard API here, but at present there doesn't seem to be one.
(I'm the tech lead for Cloudflare Workers.)
by fyrn- on 12/18/21, 4:14 AM
by aliswe on 12/17/21, 9:18 PM