Skip to main content
Deno 2 is finally here 🎉️
Learn more
Go to Latest
interface StreamAPI
import { type StreamAPI } from "https://deno.land/x/natsws@v1.28.0/src/mod.ts";

Methods

info(stream: string, opts?: Partial<StreamInfoRequestOptions>): Promise<StreamInfo>

Returns the information about the specified stream

add(cfg: Partial<StreamConfig>): Promise<StreamInfo>

Adds a new stream with the specified stream configuration.

update(name: string, cfg: Partial<StreamUpdateConfig>): Promise<StreamInfo>

Updates the stream configuration for the specified stream.

purge(stream: string, opts?: PurgeOpts): Promise<PurgeResponse>

Purges messages from a stream that match the specified purge options.

delete(stream: string): Promise<boolean>

Deletes the specified stream

list(subject?: string): Lister<StreamInfo>

Lists all streams stored by JetStream

deleteMessage(
stream: string,
seq: number,
erase?: boolean,
): Promise<boolean>

Deletes the specified message sequence from the stream

getMessage(stream: string, query: MsgRequest): Promise<StoredMsg>

Retrieves the message matching the specified query. Messages can be retrieved by sequence number or by last sequence matching a subject.

find(subject: string): Promise<string>

Find the stream that stores the specified subject.

listKvs(): Lister<KvStatus>

Returns a list of KvStatus for all streams that are identified as being a KV (that is having names that have the prefix KV_)

listObjectStores(): Lister<ObjectStoreStatus>

Returns a list of ObjectStoreInfo for all streams that are identified as being a ObjectStore (that is having names that have the prefix OBJ_)

names(subject?: string): Lister<string>

Return a Lister of stream names

get(name: string): Promise<Stream>

Returns a Stream object