astro-routify 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/dist/core/stream.js +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -86,7 +86,6 @@ endpoint system.
|
|
|
86
86
|
- `streamJsonArray()` — server-side streamed JSON arrays
|
|
87
87
|
|
|
88
88
|
> 🔄 See [CHANGELOG.md](./CHANGELOG.md) for recent updates and improvements.
|
|
89
|
-
|
|
90
89
|
---
|
|
91
90
|
|
|
92
91
|
## 🧠 Core Concepts
|
|
@@ -172,7 +171,7 @@ fileResponse(content, "application/pdf", "report.pdf"); // sets Content-Type and
|
|
|
172
171
|
```ts
|
|
173
172
|
stream('/clock', async ({response}) => {
|
|
174
173
|
const timer = setInterval(() => {
|
|
175
|
-
response.write(
|
|
174
|
+
response.write(new Date().toISOString());
|
|
176
175
|
}, 1000);
|
|
177
176
|
|
|
178
177
|
setTimeout(() => {
|
package/dist/core/stream.js
CHANGED
|
@@ -35,7 +35,9 @@ export function stream(path, handler, options) {
|
|
|
35
35
|
write: (chunk) => {
|
|
36
36
|
if (closed || !controllerRef)
|
|
37
37
|
return;
|
|
38
|
-
const bytes = typeof chunk === 'string' ?
|
|
38
|
+
const bytes = typeof chunk === 'string' ?
|
|
39
|
+
encoder.encode(`data: ${chunk}\n\n`)
|
|
40
|
+
: chunk;
|
|
39
41
|
controllerRef.enqueue(bytes);
|
|
40
42
|
},
|
|
41
43
|
close: () => {
|