@cosmjs/stream
Advanced tools
+39
| # @cosmjs/stream Agent Guide | ||
| > **Package**: `@cosmjs/stream` v0.38.0 **Purpose**: Reactive stream utilities | ||
| > **Layer**: Transport Layer | ||
| ## Package Overview | ||
| Provides reactive stream utilities built on xstream for handling asynchronous | ||
| data flows. Used internally by `@cosmjs/tendermint-rpc` for WebSocket | ||
| subscriptions. | ||
| ### Key Features | ||
| - **DefaultValueProducer**: Stream with default value | ||
| - **toListPromise**: Collect stream to array | ||
| - **firstEvent**: Get first event from stream | ||
| - **concat**: Combine streams | ||
| ## Common Usage | ||
| ```typescript | ||
| import { DefaultValueProducer, toListPromise } from "@cosmjs/stream"; | ||
| // Create stream with default | ||
| const producer = new DefaultValueProducer(initialValue); | ||
| const stream = xs.create(producer); | ||
| // Collect all values | ||
| const values = await toListPromise(stream, 5); // Wait for 5 values | ||
| // Get first value | ||
| const first = await firstEvent(stream); | ||
| ``` | ||
| --- | ||
| **Last Updated**: January 6, 2026 **Package Version**: 0.38.0 | ||
+2
-2
| { | ||
| "name": "@cosmjs/stream", | ||
| "version": "0.38.1", | ||
| "version": "0.39.0", | ||
| "description": "Utility functions for producing and consuming streams", | ||
@@ -50,3 +50,3 @@ "contributors": [ | ||
| "devDependencies": { | ||
| "@cosmjs/utils": "^0.38.1", | ||
| "@cosmjs/utils": "^0.39.0", | ||
| "@istanbuljs/nyc-config-typescript": "^1.0.1", | ||
@@ -53,0 +53,0 @@ "@types/jasmine": "^4", |
31707
3.15%24
4.35%