StreamData

The StreamData class is deprecated and will be removed in a future version of AI SDK. Please use createDataStream, createDataStreamResponse, and pipeDataStreamToResponse instead.

The StreamData class allows you to stream additional data to the client (see Streaming Data).

Import

React

import { StreamData } from "ai"

API Signature

Constructor

const data = new StreamData();

Methods

append

Appends a value to the stream data.

data.append(value: JSONValue)

appendMessageAnnotation

Appends a message annotation to the stream data.

data.appendMessageAnnotation(annotation: JSONValue)

close

Closes the stream data.

data.close();