/* pipe ...*/
Stream.flatMap(({ response, body, parsedLength }) =>
ReadableStreamStream(body).pipe(
Stream.map(({ length, stuff }) => ({
length,
stuff,
done: false,
progress: length / parsedLength,
})),
Stream.onDone(latestValues => /* do something with the latest chunk - this doesn't work because onDone doesn't take arguments */),
),
),
/* ... */
/* pipe ...*/
Stream.flatMap(({ response, body, parsedLength }) =>
ReadableStreamStream(body).pipe(
Stream.map(({ length, stuff }) => ({
length,
stuff,
done: false,
progress: length / parsedLength,
})),
Stream.onDone(latestValues => /* do something with the latest chunk - this doesn't work because onDone doesn't take arguments */),
),
),
/* ... */