workbox-streams

Types

StreamsHandlerCallback()

workbox-streams.StreamsHandlerCallback(
__namedParameters: RouteHandlerCallbackOptions ,
)
: StreamSource | Promise<StreamSource>

Parameters

Returns

StreamSource

Enum

Response

ReadableStream

BodyInit

Methods

concatenate()

workbox-streams.concatenate(
sourcePromises: Promise<StreamSource>[],
)
: object

Takes multiple source Promises, each of which could resolve to a Response, a ReadableStream, or a BodyInit.

Returns an object exposing a ReadableStream with each individual stream's data returned in sequence, along with a Promise which signals when the stream is finished (useful for passing to a FetchEvent's waitUntil()).

Parameters

Returns

  • object

    }

concatenateToResponse()

workbox-streams.concatenateToResponse(
sourcePromises: Promise<StreamSource>[],
headersInit: HeadersInit,
)
: object

Takes multiple source Promises, each of which could resolve to a Response, a ReadableStream, or a BodyInit, along with a HeadersInit.

Returns an object exposing a Response whose body consists of each individual stream's data returned in sequence, along with a Promise which signals when the stream is finished (useful for passing to a FetchEvent's waitUntil()).

Parameters

  • sourcePromises

    Promise<StreamSource>[]

  • headersInit

    HeadersInit

Returns

  • object

    }

isSupported()

workbox-streams.isSupported(): boolean

This is a utility method that determines whether the current browser supports the features required to create streamed responses. Currently, it checks if ReadableStream can be created.

Returns

  • boolean

    true, if the current browser meets the requirements for streaming responses, and false otherwise.

strategy()

workbox-streams.strategy(
sourceFunctions: StreamsHandlerCallback [],
headersInit: HeadersInit,
)
: RouteHandlerCallback

A shortcut to create a strategy that could be dropped-in to Workbox's router.

On browsers that do not support constructing new ReadableStreams, this strategy will automatically wait for all the sourceFunctions to complete, and create a final response that concatenates their values together.

Parameters

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026年07月03日 UTC.