The .drft container · function

streamDrft

Read a .drft from a fetch response as it arrives.

Explained in The .drft container.

function streamDrft(response: Response, handlers?: DrftStreamHandlers, pacing?: DrftStreamPacing): Promise<void>
import { streamDrft } from '@driftengine/drft';

Parameters

ParameterTypeDescription
responseResponse
handlers?DrftStreamHandlers
pacing?DrftStreamPacing

In depth

The whole point of the sequential design in one function: a plain fetch of a plain file, and the model improves as the bytes land. A response with no body — an error page, a cache miss served as a redirect — throws rather than resolving to an empty asset.