Blazingly faster alternative to cheerio.
Supported only on Bun runtime and cloudflare.
const $ = beerio.load(`<h2 class="title">Hello world</h2>`);
$("h2.title").text("hello");
$.html();
The above code was benchmarked in mitata for both the libraries.
cpu: 12th Gen Intel(R) Core(TM) i7-12700H
runtime: bun 1.0.26 (x64-linux)
benchmark time (avg) (min … max)
-------------------------------------------------
beerio 4,090 ns/iter (3,653 ns … 6,347 ns)
cheerio 10.69 µs/iter (7,683 ns … 1,866 µs)
-
Beerio is a custom implementation of cheerio APIs by using underlying native HTMLRewriter to directly parse and manipulate the document quickly skipping both DOM parsing and rendering them back to HTML.
-
Yes, but partially. Beerio is an alternative and does not strive to be a full drop-in replacement. Although Beerio APIs are kept consistent and similar to cheerio's but as there is no full DOM parsing, beerio is able to implement only a small portion of cheerio APIs.
Check out the full documentation here.
This repository uses MIT License. See LICENSE for full license text.