@miniflare/html-rewriter
v2.14.4
Published
HTMLRewriter module for Miniflare: a fun, full-featured, fully-local simulator for Cloudflare Workers
Downloads
385,907
Maintainers
Readme
@miniflare/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 "@miniflare/core";
import { HTMLRewriter } from "@miniflare/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>