<br />

## Types

### StreamsHandlerCallback()

```typescript
workbox-streams.StreamsHandlerCallback(
  __namedParameters: RouteHandlerCallbackOptions,
): StreamSource | Promise<https://developer.chrome.com/docs/workbox/modules/workbox-streams#type-StreamSource>
```

#### Parameters

- __namedParameters [RouteHandlerCallbackOptions](https://developer.chrome.com/docs/workbox/workbox-core/#type-RouteHandlerCallbackOptions)

#### Returns

- [StreamSource](https://developer.chrome.com/docs/workbox/modules/workbox-streams#type-StreamSource) \| Promise\<[StreamSource](https://developer.chrome.com/docs/workbox/modules/workbox-streams#type-StreamSource)\>

### StreamSource

#### Enum

Response
ReadableStream
BodyInit

<br />

## Methods

### concatenate()

```typescript
workbox-streams.concatenate(
  sourcePromises: Promise<https://developer.chrome.com/docs/workbox/modules/workbox-streams#type-StreamSource>[],
): object
```

Takes multiple source Promises, each of which could resolve to a Response, a
ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#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

- sourcePromises Promise\<[StreamSource](https://developer.chrome.com/docs/workbox/modules/workbox-streams#type-StreamSource)\>\[\]

#### Returns

- object
  > }

### concatenateToResponse()

```typescript
workbox-streams.concatenateToResponse(
  sourcePromises: Promise<https://developer.chrome.com/docs/workbox/modules/workbox-streams#type-StreamSource>[],
  headersInit: HeadersInit,
): object
```

Takes multiple source Promises, each of which could resolve to a Response, a
ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit),
along with a
[HeadersInit](https://fetch.spec.whatwg.org/#typedefdef-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](https://developer.chrome.com/docs/workbox/modules/workbox-streams#type-StreamSource)\>\[\]
- headersInit HeadersInit

#### Returns

- object
  > }

### isSupported()

```typescript
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`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)
can be created.

#### Returns

- boolean

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

### strategy()

```typescript
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 `ReadableStream`s, this
strategy will automatically wait for all the `sourceFunctions` to complete,
and create a final response that concatenates their values together.

#### Parameters

- sourceFunctions [StreamsHandlerCallback](https://developer.chrome.com/docs/workbox/modules/workbox-streams#method-StreamsHandlerCallback)\[\]
- headersInit HeadersInit

#### Returns

- [RouteHandlerCallback](https://developer.chrome.com/docs/workbox/workbox-core/#method-RouteHandlerCallback)

<br />