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

@vercel/speed-insights

Package Overview
Dependencies
Maintainers
212
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vercel/speed-insights

Speed Insights is a tool for measuring web performance and providing suggestions for improvement.

  • 0.0.1-beta.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
322K
increased by0.53%
Maintainers
212
Weekly downloads
 
Created

What is @vercel/speed-insights?

@vercel/speed-insights is an npm package designed to provide insights into the performance of web applications. It leverages Google's Lighthouse to analyze and generate reports on various performance metrics, helping developers optimize their applications for better speed and user experience.

What are @vercel/speed-insights's main functionalities?

Generate Performance Report

This feature allows you to generate a performance report for a given URL. The `getSpeedInsights` function fetches the performance metrics and returns a detailed report.

const { getSpeedInsights } = require('@vercel/speed-insights');

async function generateReport(url) {
  const report = await getSpeedInsights({ url });
  console.log(report);
}

generateReport('https://example.com');

Custom Configuration

This feature allows you to customize the performance report by specifying options such as the strategy (mobile or desktop) and the categories of metrics to include in the report.

const { getSpeedInsights } = require('@vercel/speed-insights');

async function generateCustomReport(url) {
  const options = {
    strategy: 'mobile',
    categories: ['performance', 'accessibility']
  };
  const report = await getSpeedInsights({ url, options });
  console.log(report);
}

generateCustomReport('https://example.com');

Save Report to File

This feature allows you to save the generated performance report to a file. The `fs` module is used to write the report data to a specified file path.

const { getSpeedInsights } = require('@vercel/speed-insights');
const fs = require('fs');

async function saveReportToFile(url, filePath) {
  const report = await getSpeedInsights({ url });
  fs.writeFileSync(filePath, JSON.stringify(report, null, 2));
  console.log(`Report saved to ${filePath}`);
}

saveReportToFile('https://example.com', './report.json');

Other packages similar to @vercel/speed-insights

Keywords

FAQs

Package last updated on 11 Sep 2023

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