@s2-dev/streamstore - v0.22.0
    Preparing search index...

    Class S2Stream

    Basin-scoped stream helper for append/read operations.

    Created via S2Basin.stream. Provides direct methods plus factories for read/append sessions.

    Index

    Constructors

    Properties

    name: string

    Methods

    • Append a batch of records to the stream.

      • Automatically base64-encodes when format is "bytes".
      • Supports conditional appends via fencingToken and matchSeqNum in the input.
      • Returns the acknowledged range and the stream tail after the append.
      • All records in a batch must use the same format (either all string or all bytes).

      Use AppendInput.create to construct a validated AppendInput. For high-throughput sequential appends, use appendSession() instead.

      Parameters

      • input: AppendInput

        The append input containing records and optional conditions

      • Optionaloptions: S2RequestOptions

        Optional request options

      Returns Promise<AppendAck>

    • Read records from the stream.

      • When as: "bytes" is provided, bodies and headers are decoded from base64 to Uint8Array.
      • Supports starting position by seq_num, timestamp, or tail_offset and can clamp to the tail.
      • Non-streaming reads are bounded by count and bytes (defaults 1000 and 1 MiB).
      • Use readSession for streaming reads

      Type Parameters

      • Format extends "string" | "bytes" = "string"

      Parameters

      Returns Promise<ReadBatch<Format>>