Re: [whatwg/fetch] Streaming upload (Issue #1438)

@benbucksch 

Let's assume the full-duplex mode is specified. Let's assume we have `stream` which we want to upload.
The following is what you want, I think.

```js
const reader = stream.getReader();
const p = fetch(url, { method: 'POST', duplex: 'full', body: new ReadableStream({
  start(c) { return p; },
  pull(c) { return reader.read().then((v) => { c.enqueue(v); }); },
  cancel(r) { return reader.cancel(r); },
  })});
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/1438#issuecomment-1161500159
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/issues/1438/1161500159@github.com>

Received on Tuesday, 21 June 2022 09:32:05 UTC