Skip to content

Commit 774c9b6

Browse files
KyleAMathewsclaude
andcommitted
Fix README examples: replace live: "catchup" with live: false
The API uses `live: false` for catch-up-only mode (get existing data, then stop). The non-existent `live: "catchup"` value was used in examples. Updated all code examples to use the correct `live: false` syntax. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent e4462b3 commit 774c9b6

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ const stream = new DurableStream({
131131
})
132132

133133
// Read existing data from stream (returns immediately)
134-
const result = await stream.read({ live: "catchup" })
134+
const result = await stream.read({ live: false })
135135
console.log(new TextDecoder().decode(result.data))
136136
```
137137

@@ -157,18 +157,18 @@ await stream.append(JSON.stringify({ event: "user.created", userId: "123" }))
157157
await stream.append(JSON.stringify({ event: "user.updated", userId: "123" }))
158158

159159
// Writer also includes all read operations
160-
const result = await stream.read({ live: "catchup" })
160+
const result = await stream.read({ live: false })
161161
```
162162

163163
### Resume from an offset
164164

165165
```typescript
166166
// Read and save the offset
167-
const result = await stream.read({ live: "catchup" })
167+
const result = await stream.read({ live: false })
168168
const savedOffset = result.offset // Save this for later
169169

170-
// Resume from saved offset (catchup mode returns immediately)
171-
const resumed = await stream.read({ offset: savedOffset, live: "catchup" })
170+
// Resume from saved offset (catch-up mode returns immediately)
171+
const resumed = await stream.read({ offset: savedOffset, live: false })
172172
```
173173

174174
## Protocol in 60 Seconds
@@ -237,7 +237,7 @@ await stream.append("hello")
237237
await stream.append("world")
238238

239239
// Read from beginning - returns all data concatenated
240-
const result = await stream.read({ live: "catchup" })
240+
const result = await stream.read({ live: false })
241241
// result.data = "helloworld" (complete stream from offset to end)
242242

243243
// If more data arrives and you read again from the returned offset
@@ -274,7 +274,7 @@ await stream.append({ event: "user.created", userId: "123" })
274274
await stream.append({ event: "user.updated", userId: "123" })
275275

276276
// Read returns parsed JSON array
277-
for await (const message of stream.json({ live: "catchup" })) {
277+
for await (const message of stream.json({ live: false })) {
278278
console.log(message)
279279
// { event: "user.created", userId: "123" }
280280
// { event: "user.updated", userId: "123" }
@@ -299,11 +299,11 @@ Offsets are opaque tokens that identify positions within a stream:
299299
- **Server-generated** - Always use the `offset` value returned in responses
300300

301301
```typescript
302-
// Start from beginning (catchup mode)
303-
const result = await stream.read({ offset: "-1", live: "catchup" })
302+
// Start from beginning (catch-up mode)
303+
const result = await stream.read({ offset: "-1", live: false })
304304

305305
// Resume from last position (always use returned offset)
306-
const next = await stream.read({ offset: result.offset, live: "catchup" })
306+
const next = await stream.read({ offset: result.offset, live: false })
307307
```
308308

309309
The only special offset value is `"-1"` for stream start. All other offsets are opaque strings returned by the server—never construct or parse them yourself.
@@ -508,8 +508,8 @@ Build event-sourced systems with durable event logs:
508508
await stream.append(JSON.stringify({ type: "OrderCreated", orderId: "123" }))
509509
await stream.append(JSON.stringify({ type: "OrderPaid", orderId: "123" }))
510510

511-
// Replay from beginning (catchup mode for full replay)
512-
const result = await stream.read({ offset: "-1", live: "catchup" })
511+
// Replay from beginning (catch-up mode for full replay)
512+
const result = await stream.read({ offset: "-1", live: false })
513513
const events = parseEvents(result.data)
514514
const state = events.reduce(applyEvent, initialState)
515515
```

0 commit comments

Comments
 (0)