@d1testflare/html-rewriter
v2.9.0
Published
HTMLRewriter module for Miniflare: a fun, full-featured, fully-local simulator for Cloudflare Workers
Downloads
11
Maintainers
Readme
@d1testflare/html-rewriter
HTMLRewriter module for Miniflare: a fun, full-featured, fully-local simulator for Cloudflare Workers. See 📄 HTMLRewriter for more details.
Example
import { Response } from "@d1testflare/core";
import { HTMLRewriter } from "@d1testflare/html-rewriter";
const rewriter = new HTMLRewriter().on("p", {
element(element) {
element.setInnerContent("new");
},
});
const res = new Response("<p>old</p>");
const transformed = rewriter.transform(res);
console.log(await transformed.text()); // <p>new</p>