npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@sapkotamadan/cache-server

v2.0.8

Published

CacheServer is an efficient web page extractor that uses Puppeteer to launch a headless browser and fetch web page content.

Downloads

37

Readme

CacheServer - Efficient Web Page Extractor

Package Build Downloads License

CacheServer offers a user-friendly API for loading web pages and returning their HTML source code. In addition, it simplifies automated tasks like web page extraction, data mining, and content analysis by leveraging the power of Puppeteer, a headless browser automation tool.

With a customizable configuration and easy-to-use parameters, CacheServer is the ideal solution for developers looking to enhance their web scraping and data extraction processes.

System Requirements

  • CacheServer is compatible with Node.js v14 and above, although using the latest version of Node.js is highly recommended to ensure access to all features and optimal performance.
  • If you encounter errors, please refer to the Puppeteer troubleshooting instructions:
    https://pptr.dev/troubleshooting

Note: Ensure that Node.js is properly installed and accessible in system PATH.

Installation

To install CacheServer, run the following command in your terminal:

npm i -g @sapkotamadan/cache-server

This command will globally install the CacheServer package, making it available for use across your system.

Start CacheServer:

To start CacheServer, execute the following command in your terminal:

cache-server

By default, the server will be accessible at http://localhost:8080. You can customize the configuration using optional parameters:

--host: Set the host, such as localhost or 127.0.0.1. The default is localhost.

--port: Specify an available port, like 8080 or 8095. The default is 8080.

--wait: Define the maximum wait time in seconds after the page has loaded. The default is 1 second.

--headless: Launch the Chromium browser in headless mode. The default is true; set to false to run the browser in non-headless mode, with a visible window.

For example, to run CacheServer with the customized settings, use the command like below:

cache-server --host=localhost --port=8095 --wait=5 --headless=false

Web Page Extraction

To extract a web page using the CacheServer API, send the following GET request:

http://localhost:8095/v2/page?url=...&userAgent=...&wait=...&headless=...

Parameters:

url: (Required) The URL of the web page to be extracted.

userAgent: (Optional) The user agent to be used for the request. If not specified, the default user agent will be used.

The wait and headless parameters function the same as in the server configuration and are optional for the request. Specify these parameters if you want to override the server settings for a particular request.

Response:

The response will be a JSON object with the following properties:

{
  "content": "<!DOCTYPE html><html...</html>"
}