Skip to content

Commit afa30d8

Browse files
committed
Tweaks to wording on changelog
1 parent 94f3b16 commit afa30d8

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/content/changelogs-next/2025-01-31-html-rewriter-streaming.mdx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
---
2-
title: Rewrite HTML with streaming content
2+
title: Transform HTML quickly with streaming content
33
description: HTMLRewiter now supports streamed content for more efficient replacement of HTML elements
44
products:
55
- workers
6-
date: 2025-01-31T10:00:00Z
6+
date: 2025-01-31T01:00:00Z
77
---
88

99
import { Render, TypeScriptExample } from "~/components";
1010

11-
[`HTMLRewriter`](/workers/runtime-apis/html-rewriter) now supports replacing HTML with content from a stream.
12-
[`Response`](/workers/runtime-apis/response/) and [`ReadableStream`](/workers/runtime-apis/streams/readablestream/) values can now
13-
be passed as [`Content`](/workers/runtime-apis/html-rewriter/#global-types) into methods duch as
14-
`replace`, `append`, and `prepend`.
11+
You can now transform HTML elements with streamed content using [`HTMLRewriter`](/workers/runtime-apis/html-rewriter).
1512

16-
This allows you to process HTML more efficiently, as content does not have to be loaded into memory before replacements are made.
13+
Methods like `replace`, `append`, and `prepend` now accept [`Response`](/workers/runtime-apis/response/) and [`ReadableStream`](/workers/runtime-apis/streams/readablestream/)
14+
values as [`Content`](/workers/runtime-apis/html-rewriter/#global-types).
15+
16+
This can be helpful in a variety of situations. For instance, you may have a Worker in front of an origin,
17+
and want to replace an element with content from a different source. Prior to this change, if you wanted
18+
to replace an element with content from an upstream URL, you would have to load all of the content and convert
19+
it into a string before replacing the element. This slowed down overall response times.
20+
21+
Now, you can pass the `Response` object directly into the `replace` method, and HTMLRewriter will immediately
22+
start replacing the content as it is streamed in. This makes responses faster.
1723

1824
<TypeScriptExample filename="index.ts">
1925
```ts

0 commit comments

Comments
 (0)