Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cheerio

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cheerio

Tiny, fast, and elegant implementation of core jQuery designed specifically for the server

  • 0.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9.4M
increased by3.5%
Maintainers
1
Weekly downloads
 
Created

What is cheerio?

Cheerio is a fast, flexible, and lean implementation of core jQuery designed specifically for the server. It allows users to manipulate and traverse HTML documents with a familiar jQuery-like API in a Node.js environment.

What are cheerio's main functionalities?

HTML Parsing

Cheerio can parse HTML and allows you to select and manipulate HTML elements in a way similar to jQuery.

const cheerio = require('cheerio');
const $ = cheerio.load('<h2 class="title">Hello world</h2>');
$('h2.title').text('Hello there!');
$('h2').addClass('welcome');
console.log($.html());

DOM Traversal

Cheerio provides methods to traverse the DOM tree, such as selecting elements by class, id, or tag name.

const cheerio = require('cheerio');
const $ = cheerio.load('<ul id="fruits"><li class="apple">Apple</li><li class="orange">Orange</li></ul>');
$('.apple', '#fruits').text();
$('ul .apple').attr('class');

DOM Manipulation

Cheerio allows you to manipulate the DOM by adding, removing, or modifying elements and their attributes.

const cheerio = require('cheerio');
const $ = cheerio.load('<ul id="fruits"></ul>');
$('#fruits').append('<li>Banana</li>');
$('#fruits').prepend('<li>Apple</li>');
$('#fruits').after('<p>Nothing to see here</p>');

Other packages similar to cheerio

FAQs

Package last updated on 01 Nov 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc